This need to be explicitly set in the SPIR-V validator and it is
independent of the use of scalar offsets in other storage classes.
Equivalent to --workgroup-scalar-block-layout option in spirv-val.
Components: Vulkan
Affects: dEQP-VK.*
Change-Id: I903d4c700a08d7b03ccbd3f82274379c6bd6455e
(cherry picked from commit
147bbb57041f6e243966e18d67887eac3baf9b4f)
FLAG_USE_STORAGE_BUFFER_STORAGE_CLASS = (1u<<0),
FLAG_ALLOW_RELAXED_OFFSETS = (1u<<1), // allow block offsets to follow VK_KHR_relaxed_block_layout
FLAG_ALLOW_SCALAR_OFFSETS = (1u<<2), // allow block offsets to follow VK_EXT_scalar_block_layout
- FLAG_ALLOW_STD430_UBOS = (1u<<3) // allow block offsets to follow VK_EXT_uniform_buffer_standard_layout
+ FLAG_ALLOW_STD430_UBOS = (1u<<3), // allow block offsets to follow VK_EXT_uniform_buffer_standard_layout
+ FLAG_ALLOW_WORKGROUP_SCALAR_OFFSETS = (1u<<4), // allow scalar block offsets for Workgroup memory, part of VK_KHR_workgroup_memory_explicit_layout
};
deUint32 vulkanVersion;
SpirvValidatorOptions getSpirvValidatorOptions() const
{
SpirvValidatorOptions::BlockLayoutRules rules = SpirvValidatorOptions::kDefaultBlockLayout;
+ deUint32 validator_flags = 0u;
if (flags & FLAG_ALLOW_SCALAR_OFFSETS)
{
rules = SpirvValidatorOptions::kRelaxedBlockLayout;
}
- return SpirvValidatorOptions(vulkanVersion, rules, supports_VK_KHR_spirv_1_4);
+ if (flags & FLAG_ALLOW_WORKGROUP_SCALAR_OFFSETS)
+ {
+ validator_flags |= SpirvValidatorOptions::FLAG_SPIRV_VALIDATOR_WORKGROUP_SCALAR_BLOCK_LAYOUT;
+ }
+
+ return SpirvValidatorOptions(vulkanVersion, rules, supports_VK_KHR_spirv_1_4, validator_flags);
}
};
break;
}
+ if (val_options.flags & SpirvValidatorOptions::FLAG_SPIRV_VALIDATOR_WORKGROUP_SCALAR_BLOCK_LAYOUT)
+ {
+ spvValidatorOptionsSetWorkgroupScalarBlockLayout(options, true);
+ }
+
const spv_result_t valid = spvValidateWithOptions(context, options, &cbinary, &diagnostic);
const bool passed = (valid == SPV_SUCCESS);
kScalarBlockLayout
};
- SpirvValidatorOptions(deUint32 the_vulkan_version = VK_MAKE_VERSION(1, 0, 0), BlockLayoutRules the_layout = kDefaultBlockLayout, bool allowSpirv14 = false)
- : vulkanVersion(the_vulkan_version), blockLayout(the_layout), supports_VK_KHR_spirv_1_4(allowSpirv14) {}
+ enum Flags
+ {
+ FLAG_SPIRV_VALIDATOR_WORKGROUP_SCALAR_BLOCK_LAYOUT = (1u<<0)
+ };
+
+ SpirvValidatorOptions(deUint32 the_vulkan_version = VK_MAKE_VERSION(1, 0, 0), BlockLayoutRules the_layout = kDefaultBlockLayout, bool allowSpirv14 = false, deUint32 the_flags = 0)
+ : vulkanVersion(the_vulkan_version), blockLayout(the_layout), supports_VK_KHR_spirv_1_4(allowSpirv14), flags(the_flags) {}
// The target Vulkan version. This determines the SPIR-V environment rules to
// be checked. The bit pattern is as produced by VK_MAKE_VERSION.
// Does the device support VK_KHR_spirv_1_4?
// (Camelcase would just be wrong here.)
bool supports_VK_KHR_spirv_1_4;
+
+ deUint32 flags;
};
} // namespace vk