diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index 6a9afc0b7f4..d2b273fcb58 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -334,6 +334,12 @@ typedef struct shader_info { */ enum gl_derivative_group derivative_group:2; + /* Assume that data races do not happen. If this isn't set, data races + * read/write undefined values, but do not cause undefined behaviour. This + * is set when the Vulkan memory model is used. + */ + bool assume_no_data_races:1; + union { struct { /* Which inputs are doubles */ diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index e66ee3e8c97..9f6e1a9896b 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -5327,6 +5327,7 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, case SpvMemoryModelVulkan: vtn_fail_if(!b->supported_capabilities.VulkanMemoryModel, "Vulkan memory model is unsupported by this driver"); + b->shader->info.assume_no_data_races = true; break; default: vtn_fail("Unsupported memory model: %s",