spirv: Fix reaching unreachable for compare exchange on images
authorJames Legg <jlegg@feralinteractive.com>
Mon, 26 Jun 2017 09:46:23 +0000 (10:46 +0100)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 10 Jul 2017 21:13:37 +0000 (14:13 -0700)
We were hitting the
unreachable("Invalid image opcode")
near the end of vtn_handle_image when parsing the
SpvOpAtomicCompareExchange opcode.

v2: Add stable CC.
v3: Ignore SpvOpAtomicCompareExchangeWeak. It requires the Kernel
capability which is not exposed in Vulkan, and spirv_to_nir is not used
for OpenCL which does support it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
CC: <mesa-stable@lists.freedesktop.org>
src/compiler/spirv/spirv_to_nir.c

index 8da58a7a3e0d130da870b189e4fb58067871df18..763dbf4e681955150b384817265633fcc1ecb187 100644 (file)
@@ -2008,6 +2008,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
       intrin->src[2] = nir_src_for_ssa(vtn_ssa_value(b, w[3])->def);
       break;
 
+   case SpvOpAtomicCompareExchange:
    case SpvOpAtomicIIncrement:
    case SpvOpAtomicIDecrement:
    case SpvOpAtomicExchange: