ac/radeonsi: pass bindless bool to load_sampler_desc()
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 20 Feb 2018 00:08:11 +0000 (11:08 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 28 Mar 2018 01:56:16 +0000 (12:56 +1100)
We also fix the base_index for bindless by using the driver
location.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_shader_abi.h
src/amd/vulkan/radv_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader_nir.c

index 0d85d047cd9e16ef433ba666504eb8a02ef0b25c..7de59efcffff494b2c64c314be6f8860df922054 100644 (file)
@@ -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,
index 0737d697ffa33629845f6288626552bbce4d7bb1..2f222cf8d61faf2266cadd915819a01be24c3bf1 100644 (file)
@@ -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.
index c8d383e021d0fbf51624cd94d81fbf14e37703b9..23b58c37b23a51940c1609f808560f21f34c3422 100644 (file)
@@ -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];
index 2245b39fe0a41fc20412781403175beb4ced4bce..994fee0b02cd5a7dba7fa43156fda9fdaa888035 100644 (file)
@@ -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;