[Mesa-dev] [PATCH 02/10] radeonsi: make RW buffer descriptor array global, not per shader stage

Marek Olšák maraeo at gmail.com
Thu Apr 21 15:45:15 UTC 2016


On Thu, Apr 21, 2016 at 2:49 PM, Bas Nieuwenhuizen
<bas at basnieuwenhuizen.nl> wrote:
> On Wed, Apr 20, 2016 at 5:47 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>  src/gallium/drivers/radeonsi/si_descriptors.c | 50 +++++++++++++--------------
>>  src/gallium/drivers/radeonsi/si_pipe.h        |  2 +-
>>  2 files changed, 25 insertions(+), 27 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
>> index 01cf79e..c802b1e 100644
>> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
>> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
>> @@ -900,7 +900,7 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint shader, uint slot,
>>                         unsigned element_size, unsigned index_stride, uint64_t offset)
>>  {
>>         struct si_context *sctx = (struct si_context *)ctx;
>> -       struct si_buffer_resources *buffers = &sctx->rw_buffers[shader];
>> +       struct si_buffer_resources *buffers = &sctx->rw_buffers;
>>
>>         if (shader >= SI_NUM_SHADERS)
>>                 return;
>
> I think it would be nice to remove this check and the shader argument
> to this function.
>
>> @@ -994,7 +994,7 @@ static void si_set_streamout_targets(struct pipe_context *ctx,
>>                                      const unsigned *offsets)
>>  {
>>         struct si_context *sctx = (struct si_context *)ctx;
>> -       struct si_buffer_resources *buffers = &sctx->rw_buffers[PIPE_SHADER_VERTEX];
>> +       struct si_buffer_resources *buffers = &sctx->rw_buffers;
>>         unsigned old_num_targets = sctx->b.streamout.num_targets;
>>         unsigned i, bufidx;
>>
>> @@ -1198,7 +1198,7 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource
>>
>>         /* Read/Write buffers. */
>>         for (shader = 0; shader < SI_NUM_SHADERS; shader++) {
>> -               struct si_buffer_resources *buffers = &sctx->rw_buffers[shader];
>> +               struct si_buffer_resources *buffers = &sctx->rw_buffers;
>>                 uint64_t mask = buffers->desc.enabled_mask;
>
> Looping over the shaders here seems not necessary. Also the check in
> the loop is wrong when we add the PS entries to the rw_buffers set, as
> all of the entries get first processed at the VS.

Thanks. I'll do that in a follow-up patch.

Marek


More information about the mesa-dev mailing list