[Mesa-dev] [PATCH 5/7] ac/radeonsi: pass bindless bool to load_sampler_desc()

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Feb 26 09:59:01 UTC 2018


Patches 3 and 5 are :

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

Not sure about 4 to be honest.

On 02/20/2018 04:42 AM, Timothy Arceri wrote:
> We also fix the base_index for bindless by using the driver
> location.
> ---
>   src/amd/common/ac_nir_to_llvm.c              | 14 +++++++++++---
>   src/amd/common/ac_shader_abi.h               |  3 ++-
>   src/gallium/drivers/radeonsi/si_shader_nir.c |  2 +-
>   3 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 fc89779c12..9f55be0d45 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -4664,7 +4664,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];
> @@ -4744,6 +4745,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);
> @@ -4777,14 +4779,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 62b8b7a5dc..de3034e32f 100644
> --- a/src/amd/common/ac_shader_abi.h
> +++ b/src/amd/common/ac_shader_abi.h
> @@ -156,7 +156,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/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
> index 7a5acd3ff1..c2036a1509 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
> @@ -776,7 +776,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;
> 


More information about the mesa-dev mailing list