mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-12 09:20:15 +00:00
Only validate workgroup layout for explicit workgroup memory (#4542)
Fixes #4537 * Only validate the layout of workgroup variables if the WorkgroupMemoryExplicitLayoutKHR capability is declared
This commit is contained in:
parent
2feb7074d4
commit
791f5b463a
@ -997,7 +997,9 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) {
|
||||
|
||||
const bool phys_storage_buffer =
|
||||
storageClass == SpvStorageClassPhysicalStorageBufferEXT;
|
||||
const bool workgroup = storageClass == SpvStorageClassWorkgroup;
|
||||
const bool workgroup =
|
||||
storageClass == SpvStorageClassWorkgroup &&
|
||||
vstate.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayoutKHR);
|
||||
if (uniform || push_constant || storage_buffer || phys_storage_buffer ||
|
||||
workgroup) {
|
||||
const auto ptrInst = vstate.FindDef(words[1]);
|
||||
|
@ -4372,6 +4372,29 @@ OpFunctionEnd
|
||||
HasSubstr("Cannot load a runtime-sized array"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateMemory, Pre1p4WorkgroupMemoryBadLayoutOk) {
|
||||
const std::string spirv = R"(
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpDecorate %struct Block
|
||||
OpMemberDecorate %struct 0 Offset 0
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%struct = OpTypeStruct %bool
|
||||
%ptr = OpTypePointer Workgroup %struct
|
||||
%var = OpVariable %ptr Workgroup
|
||||
%void_fn = OpTypeFunction %void
|
||||
%main = OpFunction %void None %void_fn
|
||||
%entry = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
|
||||
CompileSuccessfully(spirv);
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace val
|
||||
} // namespace spvtools
|
||||
|
Loading…
Reference in New Issue
Block a user