[Mesa-dev] [PATCH v3 1/6] radeonsi: declare new user SGPR indices for bindless samplers/images

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Aug 11 07:26:42 UTC 2017



On 08/10/2017 11:17 PM, Marek Olšák wrote:
> On Tue, Aug 8, 2017 at 6:57 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> A new pair of user SGPR is needed for loading the bindless
>> descriptors from shaders. Because the descriptors are global for
>> all stages, there is no need to add separate indices for GFX9.
>>
>> v3: - fix merged shaders on GFX9
>> v2: - fix declaring new bindless parameter
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/gallium/drivers/radeonsi/si_shader.c          | 21 +++++++++++++++++----
>>   src/gallium/drivers/radeonsi/si_shader.h          |  4 +++-
>>   src/gallium/drivers/radeonsi/si_shader_internal.h |  1 +
>>   3 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
>> index 09053c355e..035e36fbab 100644
>> --- a/src/gallium/drivers/radeonsi/si_shader.c
>> +++ b/src/gallium/drivers/radeonsi/si_shader.c
>> @@ -2900,6 +2900,9 @@ static void si_set_ls_return_value_for_tcs(struct si_shader_context *ctx)
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_merged_wave_info, 3);
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_tcs_factor_offset, 4);
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_merged_scratch_offset, 5);
>> +       ret = si_insert_input_ptr_as_2xi32(ctx, ret,
>> +               ctx->param_bindless_samplers_and_images,
>> +               8 + SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES);
>>
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_vs_state_bits,
>>                                    8 + SI_SGPR_VS_STATE_BITS);
>> @@ -2938,6 +2941,9 @@ static void si_set_es_return_value_for_gs(struct si_shader_context *ctx)
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_merged_wave_info, 3);
>>
>>          ret = si_insert_input_ret(ctx, ret, ctx->param_merged_scratch_offset, 5);
>> +       ret = si_insert_input_ptr_as_2xi32(ctx, ret,
>> +               ctx->param_bindless_samplers_and_images,
>> +               8 + SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES);
>>
>>          unsigned desc_param = ctx->param_vs_state_bits + 1;
>>          ret = si_insert_input_ptr_as_2xi32(ctx, ret, desc_param,
>> @@ -4249,6 +4255,8 @@ static void declare_default_desc_pointers(struct si_shader_context *ctx,
>>   {
>>          ctx->param_rw_buffers = add_arg(fninfo, ARG_SGPR,
>>                  si_const_array(ctx->v4i32, SI_NUM_RW_BUFFERS));
>> +       ctx->param_bindless_samplers_and_images = add_arg(fninfo, ARG_SGPR,
>> +               si_const_array(ctx->v8i32, 0));
>>          declare_per_stage_desc_pointers(ctx, fninfo, true);
>>   }
>>
>> @@ -4388,8 +4396,9 @@ static void create_function(struct si_shader_context *ctx)
>>                  add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
>>                  add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
>>
>> -               add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
>> -               add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
> 
> Don't remove these unused inputs.
> 
>> +               ctx->param_bindless_samplers_and_images =
>> +                       add_arg(&fninfo, ARG_SGPR, si_const_array(ctx->v8i32, 0));
>> +
>>                  declare_per_stage_desc_pointers(ctx, &fninfo,
>>                                                  ctx->type == PIPE_SHADER_VERTEX);
>>                  declare_vs_specific_input_sgprs(ctx, &fninfo);
>> @@ -4442,8 +4451,9 @@ static void create_function(struct si_shader_context *ctx)
>>                  add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused (SPI_SHADER_PGM_LO/HI_GS << 8) */
>>                  add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused (SPI_SHADER_PGM_LO/HI_GS >> 24) */
>>
>> -               add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
>> -               add_arg(&fninfo, ARG_SGPR, ctx->i32); /* unused */
> 
> Don't remove these unused inputs.
> 
> With those fixed, the patch is:
> 
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Fixed locally, thanks!

Samuel.

> 
> Marek
> 


More information about the mesa-dev mailing list