radeonsi: add si_set_rw_buffer to be used for internal descriptors
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 3 Jun 2016 13:27:09 +0000 (15:27 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 7 Jun 2016 13:17:59 +0000 (15:17 +0200)
So that callers outside of si_descriptors.c need to worry less about the
details of descriptor handling.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index bea751557d33378013d1147af2a89a0a15d4df9f..24fccbf29bcd0d5101055d44937ee6cc31d3fb11 100644 (file)
@@ -872,9 +872,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);
@@ -934,6 +934,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)
@@ -1230,8 +1236,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 */
index e506ec97e69efef5dde2c0afc360cdbd60bcd712..6c879f3ee6d5f659ba38b65c351e9773863705ea 100644 (file)
@@ -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);
 }
 
index d12d38357ba9d802a4d5d8aafbdc5e0e4a27ef70..52ca5932b9e0a59c64eec0271850b6fab360d4e7 100644 (file)
@@ -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;