diff options
-rw-r--r-- | src/compiler/shader_info.h | 2 | ||||
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 25 |
2 files changed, 24 insertions, 3 deletions
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index e8c875f333f..cc33899ad3e 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -75,6 +75,8 @@ struct spirv_supported_capabilities { bool tessellation; bool transform_feedback; bool variable_pointers; + bool vk_memory_model; + bool vk_memory_model_device_scope; bool float16; bool amd_gcn_shader; bool amd_shader_ballot; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 2be42fd35b4..47f00c8c163 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3792,6 +3792,14 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, case SpvCapabilityShaderClockKHR: spv_check_supported(shader_clock, cap); + break; + + case SpvCapabilityVulkanMemoryModel: + spv_check_supported(vk_memory_model, cap); + break; + + case SpvCapabilityVulkanMemoryModelDeviceScope: + spv_check_supported(vk_memory_model_device_scope, cap); break; default: @@ -3842,9 +3850,20 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, break; } - vtn_assert(w[2] == SpvMemoryModelSimple || - w[2] == SpvMemoryModelGLSL450 || - w[2] == SpvMemoryModelOpenCL); + switch (w[2]) { + case SpvMemoryModelSimple: + case SpvMemoryModelGLSL450: + case SpvMemoryModelOpenCL: + break; + case SpvMemoryModelVulkan: + 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; + } break; case SpvOpEntryPoint: |