Mesa (master): radeonsi: add ability to bind images as image buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 4 13:53:47 UTC 2019


Module: Mesa
Branch: master
Commit: 029bfa3d253ca70186e245ccf0a7e17bb40a5bab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=029bfa3d253ca70186e245ccf0a7e17bb40a5bab

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Jan  4 19:27:27 2019 -0500

radeonsi: add ability to bind images as image buffers

so that we can bind DCC (texture) as an image buffer.

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 9 ++++++---
 src/gallium/drivers/radeonsi/si_pipe.h        | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 0f22c55723c..ce67bdb87c8 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -669,7 +669,8 @@ si_mark_image_range_valid(const struct pipe_image_view *view)
 {
 	struct si_resource *res = si_resource(view->resource);
 
-	assert(res && res->b.b.target == PIPE_BUFFER);
+	if (res->b.b.target != PIPE_BUFFER)
+		return;
 
 	util_range_add(&res->valid_buffer_range,
 		       view->u.buf.offset,
@@ -686,7 +687,8 @@ static void si_set_shader_image_desc(struct si_context *ctx,
 
 	res = si_resource(view->resource);
 
-	if (res->b.b.target == PIPE_BUFFER) {
+	if (res->b.b.target == PIPE_BUFFER ||
+	    view->shader_access & SI_IMAGE_ACCESS_AS_BUFFER) {
 		if (view->access & PIPE_IMAGE_ACCESS_WRITE)
 			si_mark_image_range_valid(view);
 
@@ -787,7 +789,8 @@ static void si_set_shader_image(struct si_context *ctx,
 
 	si_set_shader_image_desc(ctx, view, skip_decompress, desc, NULL);
 
-	if (res->b.b.target == PIPE_BUFFER) {
+	if (res->b.b.target == PIPE_BUFFER ||
+	    view->shader_access & SI_IMAGE_ACCESS_AS_BUFFER) {
 		images->needs_color_decompress_mask &= ~(1 << slot);
 		res->bind_history |= PIPE_BIND_SHADER_IMAGE;
 	} else {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 16bd074f998..010374fde04 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -123,6 +123,8 @@ enum si_clear_code
 	DCC_UNCOMPRESSED       = 0xFFFFFFFF,
 };
 
+#define SI_IMAGE_ACCESS_AS_BUFFER	(1 << 7)
+
 /* Debug flags. */
 enum {
 	/* Shader logging options: */




More information about the mesa-commit mailing list