Mesa (master): radeonsi: rework the load_sampler_desc() helpers

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Sat Apr 1 16:10:07 UTC 2017


Module: Mesa
Branch: master
Commit: 2f44402386253c9f2fe0f17ff695f40d3131a0c0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f44402386253c9f2fe0f17ff695f40d3131a0c0

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Mar 30 19:58:01 2017 +0200

radeonsi: rework the load_sampler_desc() helpers

Will be more convenient for bindless because the 64bit handle is
actually the base_ptr of the descriptor (ie. 'list' will be fetched
from TGSI_FILE_CONSTANT/TGSI_FILE_TEMPORARY instead).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/radeonsi/si_shader.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 49c50b719b..2ca53dec70 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4205,9 +4205,9 @@ enum desc_type {
 /**
  * Load an image view, fmask view. or sampler state descriptor.
  */
-static LLVMValueRef load_sampler_desc_custom(struct si_shader_context *ctx,
-					     LLVMValueRef list, LLVMValueRef index,
-					     enum desc_type type)
+static LLVMValueRef load_sampler_desc(struct si_shader_context *ctx,
+				      LLVMValueRef list, LLVMValueRef index,
+				      enum desc_type type)
 {
 	struct gallivm_state *gallivm = &ctx->gallivm;
 	LLVMBuilderRef builder = gallivm->builder;
@@ -4241,15 +4241,6 @@ static LLVMValueRef load_sampler_desc_custom(struct si_shader_context *ctx,
 	return ac_build_indexed_load_const(&ctx->ac, list, index);
 }
 
-static LLVMValueRef load_sampler_desc(struct si_shader_context *ctx,
-				     LLVMValueRef index, enum desc_type type)
-{
-	LLVMValueRef list = LLVMGetParam(ctx->main_fn,
-					 SI_PARAM_SAMPLERS);
-
-	return load_sampler_desc_custom(ctx, list, index, type);
-}
-
 /* Disable anisotropic filtering if BASE_LEVEL == LAST_LEVEL.
  *
  * SI-CI:
@@ -4285,6 +4276,7 @@ static void tex_fetch_ptrs(
 	LLVMValueRef *res_ptr, LLVMValueRef *samp_ptr, LLVMValueRef *fmask_ptr)
 {
 	struct si_shader_context *ctx = si_shader_context(bld_base);
+	LLVMValueRef list = LLVMGetParam(ctx->main_fn, SI_PARAM_SAMPLERS);
 	const struct tgsi_full_instruction *inst = emit_data->inst;
 	const struct tgsi_full_src_register *reg;
 	unsigned target = inst->Texture.Texture;
@@ -4304,9 +4296,9 @@ static void tex_fetch_ptrs(
 	}
 
 	if (target == TGSI_TEXTURE_BUFFER)
-		*res_ptr = load_sampler_desc(ctx, index, DESC_BUFFER);
+		*res_ptr = load_sampler_desc(ctx, list, index, DESC_BUFFER);
 	else
-		*res_ptr = load_sampler_desc(ctx, index, DESC_IMAGE);
+		*res_ptr = load_sampler_desc(ctx, list, index, DESC_IMAGE);
 
 	if (samp_ptr)
 		*samp_ptr = NULL;
@@ -4316,10 +4308,12 @@ static void tex_fetch_ptrs(
 	if (target == TGSI_TEXTURE_2D_MSAA ||
 	    target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
 		if (fmask_ptr)
-			*fmask_ptr = load_sampler_desc(ctx, index, DESC_FMASK);
+			*fmask_ptr = load_sampler_desc(ctx, list, index,
+						       DESC_FMASK);
 	} else if (target != TGSI_TEXTURE_BUFFER) {
 		if (samp_ptr) {
-			*samp_ptr = load_sampler_desc(ctx, index, DESC_SAMPLER);
+			*samp_ptr = load_sampler_desc(ctx, list, index,
+						      DESC_SAMPLER);
 			*samp_ptr = sici_fix_sampler_aniso(ctx, *res_ptr, *samp_ptr);
 		}
 	}




More information about the mesa-commit mailing list