Skip to content

Commit 5039ae9

Browse files
committed
Enable relaxed block layout by default for Universal SPIR-V 1.3+
SPIR-V 1.3 was introduced alongside Vulkan 1.1, which mandates VK_KHR_relaxed_block_layout as core. Auto-enable relaxed block layout for Universal 1.3+ targets to match this expectation, preventing false positives on structs with vec3 members at offsets that satisfy relaxed but not strict alignment rules.
1 parent 0d0ba1d commit 5039ae9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

rust/spirv-tools/src/val.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,20 @@ impl Validator for RustValidator {
9292
// Build core validation options
9393
let mut core_opts = CoreOptions::default();
9494

95-
// Vulkan 1.1+ enables relaxed block layout by default
95+
// Vulkan 1.1+ enables relaxed block layout by default (VK_KHR_relaxed_block_layout
96+
// is core in Vulkan 1.1). Universal SPIR-V 1.3+ also defaults to relaxed layout
97+
// since SPIR-V 1.3 was introduced alongside Vulkan 1.1.
9698
let default_relax_block_layout = matches!(
9799
self.target_env,
98100
TargetEnv::Vulkan_1_1
99101
| TargetEnv::Vulkan_1_1_Spirv_1_4
100102
| TargetEnv::Vulkan_1_2
101103
| TargetEnv::Vulkan_1_3
102104
| TargetEnv::Vulkan_1_4
105+
| TargetEnv::Universal_1_3
106+
| TargetEnv::Universal_1_4
107+
| TargetEnv::Universal_1_5
108+
| TargetEnv::Universal_1_6
103109
);
104110

105111
if let Some(opts) = options {

0 commit comments

Comments
 (0)