spirv: fix AtomicLoad/Store on images
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 19 Sep 2016 16:14:18 +0000 (17:14 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 22 Sep 2016 11:08:21 +0000 (14:08 +0300)
OpAtomicLoad/Store should have pointer to images just like the rest of the
atomic operators. These couple of lines were poorly copied from the
ssbo/shared_vars cases (the only ones currently tests by the CTS).

Fixes 2afb950161f8 ("spirv/nir: Add support for OpAtomicLoad/Store")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c

index 04add3e5d373e997375ddf2ed428d459908a8341..de2cebc3f2d3cf61137253499099925250a908ba 100644 (file)
@@ -1671,6 +1671,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
    case SpvOpAtomicIDecrement:
    case SpvOpAtomicIAdd:
    case SpvOpAtomicISub:
+   case SpvOpAtomicLoad:
    case SpvOpAtomicSMin:
    case SpvOpAtomicUMin:
    case SpvOpAtomicSMax:
@@ -1681,17 +1682,9 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
       image = *vtn_value(b, w[3], vtn_value_type_image_pointer)->image;
       break;
 
-   case SpvOpAtomicLoad: {
-      image.image =
-         vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain;
-      break;
-   }
-
-   case SpvOpAtomicStore: {
-      image.image =
-         vtn_value(b, w[1], vtn_value_type_access_chain)->access_chain;
+   case SpvOpAtomicStore:
+      image = *vtn_value(b, w[1], vtn_value_type_image_pointer)->image;
       break;
-   }
 
    case SpvOpImageQuerySize:
       image.image =