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 bea7515..24fccbf 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 e506ec9..6c879f3 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 d12d383..52ca593 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;