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

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jul 26 14:21:51 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.

v2: - fix declaring new bindless parameter

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/radeonsi/si_shader.c          | 5 +++++
 src/gallium/drivers/radeonsi/si_shader.h          | 4 +++-
 src/gallium/drivers/radeonsi/si_shader_internal.h | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index a5baf71b0d..6885aeda82 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4079,6 +4079,8 @@ static void declare_default_desc_pointers(struct si_shader_context *ctx,
 {
 	params[ctx->param_rw_buffers = (*num_params)++] =
 		si_const_array(ctx->v4i32, SI_NUM_RW_BUFFERS);
+	params[ctx->param_bindless_samplers_and_images = (*num_params)++] =
+		si_const_array(ctx->v8i32, 0);
 	declare_per_stage_desc_pointers(ctx, params, num_params, true);
 }
 
@@ -6709,6 +6711,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;
@@ -6722,6 +6725,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;
@@ -7070,6 +7074,7 @@ static void si_build_ps_epilog_function(struct si_shader_context *ctx,
 
 	/* Declare input SGPRs. */
 	params[ctx->param_rw_buffers = num_params++] = ctx->i64;
+	params[ctx->param_bindless_samplers_and_images = 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;
 	assert(num_params == SI_PARAM_ALPHA_REF);
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index a10067d025..4ff588695a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -157,6 +157,8 @@ enum {
 	 */
 	SI_SGPR_RW_BUFFERS,  /* rings (& stream-out, VS only) */
 	SI_SGPR_RW_BUFFERS_HI,
+	SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES,
+	SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES_HI,
 	SI_SGPR_CONST_AND_SHADER_BUFFERS,
 	SI_SGPR_CONST_AND_SHADER_BUFFERS_HI,
 	SI_SGPR_SAMPLERS_AND_IMAGES,
@@ -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 6e86e0b56d..205b8b92fc 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.3



More information about the mesa-dev mailing list