summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-02-20 11:08:11 +1100
committerTimothy Arceri <[email protected]>2018-03-28 12:56:16 +1100
commit92fa89a08d1e9905897dfb5cd30b8d572f83e941 (patch)
tree2b95e8cb977ccca7886ebd78589aec73507f9653
parent5411b98d5249e6ceb79f0b9923dd142fbbce8852 (diff)
ac/radeonsi: pass bindless bool to load_sampler_desc()
We also fix the base_index for bindless by using the driver location. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c11
-rw-r--r--src/amd/common/ac_shader_abi.h3
-rw-r--r--src/amd/vulkan/radv_nir_to_llvm.c3
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c2
4 files changed, 14 insertions, 5 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 0d85d047cd9..7de59efcfff 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3030,6 +3030,7 @@ static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx,
unsigned constant_index = 0;
unsigned descriptor_set;
unsigned base_index;
+ bool bindless = false;
if (!deref) {
assert(tex_instr && !image);
@@ -3063,14 +3064,20 @@ static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx,
tail = &child->deref;
}
descriptor_set = deref->var->data.descriptor_set;
- base_index = deref->var->data.binding;
+
+ if (deref->var->data.bindless) {
+ bindless = deref->var->data.bindless;
+ base_index = deref->var->data.driver_location;
+ } else {
+ base_index = deref->var->data.binding;
+ }
}
return ctx->abi->load_sampler_desc(ctx->abi,
descriptor_set,
base_index,
constant_index, index,
- desc_type, image, write);
+ desc_type, image, write, bindless);
}
static void set_tex_fetch_args(struct ac_llvm_context *ctx,
diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
index 0737d697ffa..2f222cf8d61 100644
--- a/src/amd/common/ac_shader_abi.h
+++ b/src/amd/common/ac_shader_abi.h
@@ -157,7 +157,8 @@ struct ac_shader_abi {
unsigned constant_index,
LLVMValueRef index,
enum ac_descriptor_type desc_type,
- bool image, bool write);
+ bool image, bool write,
+ bool bindless);
/**
* Load a Vulkan-specific resource.
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index c8d383e021d..23b58c37b23 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -1699,7 +1699,8 @@ static LLVMValueRef radv_get_sampler_desc(struct ac_shader_abi *abi,
unsigned constant_index,
LLVMValueRef index,
enum ac_descriptor_type desc_type,
- bool image, bool write)
+ bool image, bool write,
+ bool bindless)
{
struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
LLVMValueRef list = ctx->descriptor_sets[descriptor_set];
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 2245b39fe0a..994fee0b02c 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -784,7 +784,7 @@ si_nir_load_sampler_desc(struct ac_shader_abi *abi,
unsigned descriptor_set, unsigned base_index,
unsigned constant_index, LLVMValueRef dynamic_index,
enum ac_descriptor_type desc_type, bool image,
- bool write)
+ bool write, bool bindless)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
LLVMBuilderRef builder = ctx->ac.builder;