[Mesa-dev] [PATCH 1/6] radeonsi: declare new user SGPR indices for bindless samplers/images
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Jul 4 13:05:52 UTC 2017
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;
}
}
@@ -6734,6 +6736,7 @@ static void si_build_tcs_epilog_function(struct si_shader_context *ctx,
params[num_params++] = ctx->i64;
params[num_params++] = ctx->i64;
params[num_params++] = ctx->i64;
+ params[num_params++] = ctx->i64;
params[num_params++] = ctx->i32;
params[num_params++] = ctx->i32;
params[num_params++] = ctx->i32;
@@ -6747,6 +6750,7 @@ static void si_build_tcs_epilog_function(struct si_shader_context *ctx,
params[num_params++] = ctx->i64;
params[num_params++] = ctx->i64;
params[num_params++] = ctx->i64;
+ params[num_params++] = ctx->i64;
params[ctx->param_tcs_offchip_layout = num_params++] = ctx->i32;
params[num_params++] = ctx->i32;
params[num_params++] = ctx->i32;
@@ -7097,6 +7101,7 @@ static void si_build_ps_epilog_function(struct si_shader_context *ctx,
params[ctx->param_rw_buffers = num_params++] = ctx->i64;
params[ctx->param_const_and_shader_buffers = num_params++] = ctx->i64;
params[ctx->param_samplers_and_images = num_params++] = ctx->i64;
+ params[ctx->param_bindless_samplers_and_images = num_params++] = ctx->i64;
assert(num_params == SI_PARAM_ALPHA_REF);
params[SI_PARAM_ALPHA_REF] = ctx->f32;
last_sgpr = SI_PARAM_ALPHA_REF;
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index a10067d025..1852b3d5f7 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -161,6 +161,8 @@ enum {
SI_SGPR_CONST_AND_SHADER_BUFFERS_HI,
SI_SGPR_SAMPLERS_AND_IMAGES,
SI_SGPR_SAMPLERS_AND_IMAGES_HI,
+ SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES,
+ SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES_HI,
SI_NUM_RESOURCE_SGPRS,
/* all VS variants */
@@ -217,7 +219,7 @@ enum {
/* LLVM function parameter indices */
enum {
- SI_NUM_RESOURCE_PARAMS = 3,
+ SI_NUM_RESOURCE_PARAMS = 4,
/* PS only parameters */
SI_PARAM_ALPHA_REF = SI_NUM_RESOURCE_PARAMS,
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 3556e69cd0..97594dc02b 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -117,6 +117,7 @@ struct si_shader_context {
int param_rw_buffers;
int param_const_and_shader_buffers;
int param_samplers_and_images;
+ int param_bindless_samplers_and_images;
/* Common inputs for merged shaders. */
int param_merged_wave_info;
int param_merged_scratch_offset;
--
2.13.2
More information about the mesa-dev
mailing list