[Mesa-dev] [PATCH v2 1/3] spirv: Fix reaching unreachable for compare exchange on images

James Legg jlegg at feralinteractive.com
Fri Jun 23 10:18:55 UTC 2017


We were hitting the
	unreachable("Invalid image opcode")
near the end of vtn_handle_image when parsing SpvOpAtomicCompareExchange
and SpvOpAtomicCompareExchangeWeak opcodes.

v2: Add stable CC

CC: <mesa-stable at lists.freedesktop.org>
---
 src/compiler/spirv/spirv_to_nir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 0a5eb0e..8f21aec 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1805,6 +1805,7 @@ fill_common_atomic_sources(struct vtn_builder *b, SpvOp opcode,
       break;
 
    case SpvOpAtomicCompareExchange:
+   case SpvOpAtomicCompareExchangeWeak:
       src[0] = nir_src_for_ssa(vtn_ssa_value(b, w[8])->def);
       src[1] = nir_src_for_ssa(vtn_ssa_value(b, w[7])->def);
       break;
@@ -1977,6 +1978,8 @@ 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 SpvOpAtomicCompareExchangeWeak:
    case SpvOpAtomicIIncrement:
    case SpvOpAtomicIDecrement:
    case SpvOpAtomicExchange:
-- 
2.9.4



More information about the mesa-dev mailing list