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

Marek Olšák maraeo at gmail.com
Tue Jul 11 23:15:02 UTC 2017


On Tue, Jul 4, 2017 at 3:05 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.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/gallium/drivers/radeonsi/si_shader.c          | 9 +++++++--
>  src/gallium/drivers/radeonsi/si_shader.h          | 4 +++-
>  src/gallium/drivers/radeonsi/si_shader_internal.h | 1 +
>  3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 55d1232512..b56d2d791b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -4094,10 +4094,12 @@ static void declare_per_stage_desc_pointers(struct si_shader_context *ctx,
>                                                  SI_NUM_SHADER_BUFFERS + SI_NUM_CONST_BUFFERS);
>         params[(*num_params)++] = si_const_array(ctx->v8i32,
>                                                  SI_NUM_IMAGES + SI_NUM_SAMPLERS * 2);
> +       params[(*num_params)++] = si_const_array(ctx->v8i32, 0);
>
>         if (assign_params) {
> -               ctx->param_const_and_shader_buffers = *num_params - 2;
> -               ctx->param_samplers_and_images = *num_params - 1;
> +               ctx->param_const_and_shader_buffers = *num_params - 3;
> +               ctx->param_samplers_and_images = *num_params - 2;
> +               ctx->param_bindless_samplers_and_images = *num_params - 1;

This function is for per-stage pointers, but bindless resources are
global. It will break GFX9 HS and GS, because this function is called
twice per shader.

See how rw_buffers or vertex_buffers are declared.

Marek


More information about the mesa-dev mailing list