---
 src/compiler/shader_info.h        |  1 +
 src/compiler/spirv/spirv_to_nir.c | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 65bc0588d67..a19840666ac 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -62,6 +62,7 @@ struct spirv_supported_capabilities {
    bool post_depth_coverage;
    bool transform_feedback;
    bool geometry_streams;
+   bool vk_memory_model;
 };
 
 typedef struct shader_info {
diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 3378641513c..dcce05ce83b 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3600,6 +3600,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, 
SpvOp opcode,
          spv_check_supported(post_depth_coverage, cap);
          break;
 
+      case SpvCapabilityVulkanMemoryModelKHR:
+         spv_check_supported(vk_memory_model, cap);
+         break;
+
       default:
          vtn_fail("Unhandled capability");
       }
@@ -3612,8 +3616,20 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, 
SpvOp opcode,
 
    case SpvOpMemoryModel:
       vtn_assert(w[1] == SpvAddressingModelLogical);
-      vtn_assert(w[2] == SpvMemoryModelSimple ||
-                 w[2] == SpvMemoryModelGLSL450);
+      switch (w[2]) {
+      case SpvMemoryModelSimple:
+      case SpvMemoryModelGLSL450:
+         break;
+
+      case SpvMemoryModelVulkanKHR:
+         vtn_fail_if(!b->options->caps.vk_memory_model,
+                     "Vulkan memory model is unsupported by this driver");
+         break;
+
+      default:
+         vtn_fail("Unsupported memory model: %s",
+                  spirv_memorymodel_to_string(w[2]));
+      }
       break;
 
    case SpvOpEntryPoint:
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to