summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-09-10 12:38:00 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-10-24 11:39:56 -0700
commitc02204310212a64b765efe87c2d165ae93192899 (patch)
tree43bc6bb7adeb2624f963b30c48652d205adbf6cb /src
parent1bb191a0d19d53785f1b69c6cd797a508378bb95 (diff)
spirv: Add SpvMemoryModelVulkan and related capabilities
Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/shader_info.h2
-rw-r--r--src/compiler/spirv/spirv_to_nir.c25
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: