[Mesa-dev] [RFC PATCH 63/65] radeonsi: add support for loading bindless samplers

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri May 19 16:53:08 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index bd8ecb70f8..c9397c2fb8 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -1207,6 +1207,20 @@ static void tex_fetch_ptrs(
 				     si_get_sampler_slot(reg->Register.Index), 0);
 	}
 
+	if (reg->Register.File != TGSI_FILE_SAMPLER) {
+		struct gallivm_state *gallivm = &ctx->gallivm;
+		LLVMBuilderRef builder = gallivm->builder;
+
+		assert(inst->Texture.Bindless);
+
+		LLVMValueRef ptr =
+			lp_build_emit_fetch_src(bld_base, reg,
+						TGSI_TYPE_UNSIGNED64, 0);
+		list = LLVMBuildIntToPtr(builder, ptr,
+					 si_const_array(ctx->v8i32, 0), "");
+		index = LLVMConstInt(ctx->i32, 0, 0);
+	}
+
 	if (target == TGSI_TEXTURE_BUFFER)
 		*res_ptr = load_sampler_desc(ctx, list, index, DESC_BUFFER);
 	else
@@ -1786,7 +1800,8 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
 	    opcode == TGSI_OPCODE_TG4) {
 		const unsigned src_idx = 2;
 
-		assert(inst->Src[src_idx].Register.File == TGSI_FILE_SAMPLER);
+		assert(inst->Src[src_idx].Register.File == TGSI_FILE_SAMPLER ||
+		       inst->Texture.Bindless);
 		assert(inst->Texture.ReturnType != TGSI_RETURN_TYPE_UNKNOWN);
 
 		if (inst->Texture.ReturnType == TGSI_RETURN_TYPE_SINT ||
-- 
2.13.0



More information about the mesa-dev mailing list