From: Nicolai Hähnle Date: Fri, 3 Jun 2016 13:27:09 +0000 (+0200) Subject: radeonsi: add si_set_rw_buffer to be used for internal descriptors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba4a2840c7fb52169400420fd94c655b2b229f7e;p=mesa.git radeonsi: add si_set_rw_buffer to be used for internal descriptors So that callers outside of si_descriptors.c need to worry less about the details of descriptor handling. Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Marek Olšák --- diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index bea751557d3..24fccbf29bc 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -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 */ diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index e506ec97e69..6c879f3ee6d 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 d12d38357ba..52ca5932b9e 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;