[Mesa-dev] [PATCH] ac: fix possibly incorrect bindless atomic code in visit_image_atomic

Timothy Arceri tarceri at itsqueeze.com
Mon Apr 15 01:11:09 UTC 2019


Thanks I didn't see this and sent the same patch. Please add the 
following to the commit message:

Coverity: CID 1444664

Fixes: d62d434fe920 ("ac/nir_to_llvm: add image bindless support")

With those:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 13/4/19 1:40 am, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/amd/common/ac_nir_to_llvm.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 55c64e2aacb..afdd9318fff 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -2543,25 +2543,25 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx,
>   	int param_count = 0;
>   
>   	bool cmpswap = instr->intrinsic == nir_intrinsic_image_deref_atomic_comp_swap ||
>   		       instr->intrinsic == nir_intrinsic_bindless_image_atomic_comp_swap;
>   	const char *atomic_name;
>   	char intrinsic_name[64];
>   	enum ac_atomic_op atomic_subop;
>   	MAYBE_UNUSED int length;
>   
>   	enum glsl_sampler_dim dim;
> -	bool is_unsigned;
> +	bool is_unsigned = false;
>   	bool is_array;
>   	if (bindless) {
> -		if (instr->intrinsic == nir_intrinsic_image_atomic_min ||
> -		    instr->intrinsic == nir_intrinsic_image_atomic_max) {
> +		if (instr->intrinsic == nir_intrinsic_bindless_image_atomic_min ||
> +		    instr->intrinsic == nir_intrinsic_bindless_image_atomic_max) {
>   			const GLenum format = nir_intrinsic_format(instr);
>   			assert(format == GL_R32UI || format == GL_R32I);
>   			is_unsigned = format == GL_R32UI;
>   		}
>   		dim = nir_intrinsic_image_dim(instr);
>   		is_array = nir_intrinsic_image_array(instr);
>   	} else {
>   		const struct glsl_type *type = get_image_deref(instr)->type;
>   		is_unsigned = glsl_get_sampler_result_type(type) == GLSL_TYPE_UINT;
>   		dim = glsl_get_sampler_dim(type);
> 


More information about the mesa-dev mailing list