ac/nir: Fix ordering of parameters for image atomic cmpswap intrinsics
authorAlex Smith <asmith@feralinteractive.com>
Fri, 30 Jun 2017 10:15:42 +0000 (11:15 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 6 Jul 2017 22:57:25 +0000 (00:57 +0200)
The NIR parameters are ordered "compare, data", matching GLSL, but both
the image and buffer LLVM intrinsics take them the other way around.
This is already handled correctly for SSBO atomics.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
src/amd/common/ac_nir_to_llvm.c

index beafd5685f3cbe1ea291439786cc38a81e6d2916..922331090cb09847a31488e56aae11e5c9e2f3e0 100644 (file)
@@ -3473,9 +3473,9 @@ static LLVMValueRef visit_image_atomic(struct nir_to_llvm_context *ctx,
                abort();
        }
 
-       params[param_count++] = get_src(ctx, instr->src[2]);
        if (instr->intrinsic == nir_intrinsic_image_atomic_comp_swap)
                params[param_count++] = get_src(ctx, instr->src[3]);
+       params[param_count++] = get_src(ctx, instr->src[2]);
 
        if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_BUF) {
                params[param_count++] = get_sampler_desc(ctx, instr->variables[0], DESC_BUFFER);