spirv: Consider the sampled_image case in wa_glslang_179 workaround
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 13 Nov 2019 19:04:39 +0000 (11:04 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 13 Nov 2019 20:02:29 +0000 (12:02 -0800)
Fixes: 9e440b8d0b9 ("spirv: Sort out the mess that is sampled image")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/vtn_variables.c

index 4a9e031a9f868d7eeede3825c3a535d45209ecac..960bc01ef689f246ad0d89faf8c355b2cda6c44b 100644 (file)
@@ -2609,8 +2609,13 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
             vtn_warn("OpStore of a sampler detected.  Doing on-the-fly copy "
                      "propagation to workaround the problem.");
             vtn_assert(dest->var->copy_prop_sampler == NULL);
-            dest->var->copy_prop_sampler =
-               vtn_value(b, w[2], vtn_value_type_pointer)->pointer;
+            struct vtn_value *v = vtn_untyped_value(b, w[2]);
+            if (v->value_type == vtn_value_type_sampled_image) {
+               dest->var->copy_prop_sampler = v->sampled_image->sampler;
+            } else {
+               vtn_assert(v->value_type == vtn_value_type_pointer);
+               dest->var->copy_prop_sampler = v->pointer;
+            }
          } else {
             vtn_fail("Vulkan does not allow OpStore of a sampler or image.");
          }