[Mesa-dev] [PATCH 5/9] radeonsi: add si_set_rw_buffer to be used for internal descriptors

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 3 17:01:27 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

So that callers outside of si_descriptors.c need to worry less about the
details of descriptor handling.
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 15 ++++++++++-----
 src/gallium/drivers/radeonsi/si_state.c       |  9 +++------
 src/gallium/drivers/radeonsi/si_state.h       |  5 ++---
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index b3ba7d4..74080af 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -866,9 +866,9 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf
 		util_memcpy_cpu_to_le32(tmp, ptr, size);
 }
 
-void si_set_constant_buffer(struct si_context *sctx,
-			    struct si_buffer_resources *buffers,
-			    uint slot, struct pipe_constant_buffer *input)
+static void si_set_constant_buffer(struct si_context *sctx,
+				   struct si_buffer_resources *buffers,
+				   uint slot, struct pipe_constant_buffer *input)
 {
 	assert(slot < buffers->desc.num_elements);
 	pipe_resource_reference(&buffers->buffers[slot], NULL);
@@ -928,6 +928,12 @@ void si_set_constant_buffer(struct si_context *sctx,
 	buffers->desc.dirty_mask |= 1u << slot;
 }
 
+void si_set_rw_buffer(struct si_context *sctx,
+		      uint slot, struct pipe_constant_buffer *input)
+{
+	si_set_constant_buffer(sctx, &sctx->rw_buffers, slot, input);
+}
+
 static void si_pipe_set_constant_buffer(struct pipe_context *ctx,
 					uint shader, uint slot,
 					struct pipe_constant_buffer *input)
@@ -1224,8 +1230,7 @@ static void si_set_polygon_stipple(struct pipe_context *ctx,
 	cb.user_buffer = stipple;
 	cb.buffer_size = sizeof(stipple);
 
-	si_set_constant_buffer(sctx, &sctx->rw_buffers,
-			       SI_PS_CONST_POLY_STIPPLE, &cb);
+	si_set_rw_buffer(sctx, SI_PS_CONST_POLY_STIPPLE, &cb);
 }
 
 /* TEXTURE METADATA ENABLE/DISABLE */
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 14520ca..07ab3d2 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -620,8 +620,7 @@ static void si_set_clip_state(struct pipe_context *ctx,
 	cb.user_buffer = state->ucp;
 	cb.buffer_offset = 0;
 	cb.buffer_size = 4*4*8;
-	si_set_constant_buffer(sctx, &sctx->rw_buffers,
-			       SI_VS_CONST_CLIP_PLANES, &cb);
+	si_set_rw_buffer(sctx, SI_VS_CONST_CLIP_PLANES, &cb);
 	pipe_resource_reference(&cb.buffer, NULL);
 }
 
@@ -2363,8 +2362,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
 			assert(0);
 		}
 		constbuf.buffer_size = sctx->framebuffer.nr_samples * 2 * 4;
-		si_set_constant_buffer(sctx, &sctx->rw_buffers,
-				       SI_PS_CONST_SAMPLE_POSITIONS, &constbuf);
+		si_set_rw_buffer(sctx, SI_PS_CONST_SAMPLE_POSITIONS, &constbuf);
 
 		/* Smoothing (only possible with nr_samples == 1) uses the same
 		 * sample locations as the MSAA it simulates.
@@ -3244,8 +3242,7 @@ static void si_set_tess_state(struct pipe_context *ctx,
 			       (void*)array, sizeof(array),
 			       &cb.buffer_offset);
 
-	si_set_constant_buffer(sctx, &sctx->rw_buffers,
-			       SI_HS_CONST_DEFAULT_TESS_LEVELS, &cb);
+	si_set_rw_buffer(sctx, SI_HS_CONST_DEFAULT_TESS_LEVELS, &cb);
 	pipe_resource_reference(&cb.buffer, NULL);
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index d12d383..52ca593 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -276,9 +276,8 @@ void si_update_compressed_colortex_masks(struct si_context *sctx);
 void si_emit_graphics_shader_userdata(struct si_context *sctx,
                                       struct r600_atom *atom);
 void si_emit_compute_shader_userdata(struct si_context *sctx);
-void si_set_constant_buffer(struct si_context *sctx,
-			    struct si_buffer_resources *buffers,
-			    uint slot, struct pipe_constant_buffer *input);
+void si_set_rw_buffer(struct si_context *sctx,
+		      uint slot, struct pipe_constant_buffer *input);
 
 /* si_state.c */
 struct si_shader_selector;
-- 
2.7.4



More information about the mesa-dev mailing list