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

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Apr 12 16:06:50 UTC 2019


possibly? :)

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

On 4/12/19 5:40 PM, 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