mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-25 13:00:04 +00:00
Allow OpTypeBool in UniformConstant (#5237)
See https://github.com/KhronosGroup/SPIRV-Registry/issues/72 * OpenGL allowed uniforms to be declared with boolean types, but the validator was overly strict in disallowing it
This commit is contained in:
parent
5ed21eb1e2
commit
59b4febd81
@ -442,6 +442,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
|
||||
storage_class != spv::StorageClass::CrossWorkgroup &&
|
||||
storage_class != spv::StorageClass::Private &&
|
||||
storage_class != spv::StorageClass::Function &&
|
||||
storage_class != spv::StorageClass::UniformConstant &&
|
||||
storage_class != spv::StorageClass::RayPayloadKHR &&
|
||||
storage_class != spv::StorageClass::IncomingRayPayloadKHR &&
|
||||
storage_class != spv::StorageClass::HitAttributeKHR &&
|
||||
@ -475,8 +476,8 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
|
||||
"can only be used with non-externally visible shader Storage "
|
||||
"Classes: Workgroup, CrossWorkgroup, Private, Function, "
|
||||
"Input, Output, RayPayloadKHR, IncomingRayPayloadKHR, "
|
||||
"HitAttributeKHR, CallableDataKHR, or "
|
||||
"IncomingCallableDataKHR";
|
||||
"HitAttributeKHR, CallableDataKHR, "
|
||||
"IncomingCallableDataKHR, or UniformConstant";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2317,7 +2317,7 @@ OpFunctionEnd
|
||||
"be used with non-externally visible shader Storage Classes: "
|
||||
"Workgroup, CrossWorkgroup, Private, Function, Input, Output, "
|
||||
"RayPayloadKHR, IncomingRayPayloadKHR, HitAttributeKHR, "
|
||||
"CallableDataKHR, or IncomingCallableDataKHR")));
|
||||
"CallableDataKHR, IncomingCallableDataKHR, or UniformConstant")));
|
||||
}
|
||||
|
||||
TEST_P(ValidateIdWithMessage, OpVariableContainsBoolPrivateGood) {
|
||||
@ -2339,6 +2339,25 @@ OpFunctionEnd
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_P(ValidateIdWithMessage, OpVariableContainsBoolUniformConstantGood) {
|
||||
std::string spirv = kGLSL450MemoryModel + R"(
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%block = OpTypeStruct %bool %int
|
||||
%_ptr_UniformConstant_block = OpTypePointer UniformConstant %block
|
||||
%var = OpVariable %_ptr_UniformConstant_block UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%fnty = OpTypeFunction %void
|
||||
%main = OpFunction %void None %fnty
|
||||
%entry = OpLabel
|
||||
%load = OpLoad %block %var
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
CompileSuccessfully(spirv.c_str());
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_P(ValidateIdWithMessage, OpVariableContainsBoolPointerGood) {
|
||||
std::string spirv = kGLSL450MemoryModel + R"(
|
||||
%bool = OpTypeBool
|
||||
|
Loading…
Reference in New Issue
Block a user