From c02204310212a64b765efe87c2d165ae93192899 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Tue, 10 Sep 2019 12:38:00 -0700 Subject: spirv: Add SpvMemoryModelVulkan and related capabilities Reviewed-by: Jason Ekstrand Reviewed-by: Bas Nieuwenhuizen --- src/compiler/spirv/spirv_to_nir.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/compiler/spirv') 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: -- cgit v1.2.3