mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
spirv-val: Label VUID 07290 (#4927)
This commit is contained in:
parent
8422d8a44b
commit
5f4ce362ad
@ -459,6 +459,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
|
||||
ContainsInvalidBool(_, value_type, storage_input_or_output)) {
|
||||
if (storage_input_or_output) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< _.VkErrorID(7290)
|
||||
<< "If OpTypeBool is stored in conjunction with OpVariable "
|
||||
"using Input or Output Storage Classes it requires a BuiltIn "
|
||||
"decoration";
|
||||
|
@ -2110,6 +2110,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-Uniform-06925);
|
||||
case 6997:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-SubgroupVoteKHR-06997);
|
||||
case 7290:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-Input-07290);
|
||||
default:
|
||||
return ""; // unknown id
|
||||
}
|
||||
|
@ -2278,6 +2278,35 @@ OpFunctionEnd
|
||||
"or Output Storage Classes it requires a BuiltIn decoration"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateIdWithMessage, OpVariableContainsNoBuiltinBoolBadVulkan) {
|
||||
std::string spirv = R"(
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %var
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
%bool = OpTypeBool
|
||||
%input = OpTypeStruct %bool
|
||||
%_ptr_input = OpTypePointer Input %input
|
||||
%var = OpVariable %_ptr_input Input
|
||||
%void = OpTypeVoid
|
||||
%fnty = OpTypeFunction %void
|
||||
%main = OpFunction %void None %fnty
|
||||
%entry = OpLabel
|
||||
%load = OpLoad %input %var
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
CompileSuccessfully(spirv.c_str(), SPV_ENV_VULKAN_1_0);
|
||||
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-Input-07290"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr(
|
||||
"If OpTypeBool is stored in conjunction with OpVariable using Input "
|
||||
"or Output Storage Classes it requires a BuiltIn decoration"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateIdWithMessage, OpVariableContainsRayPayloadBoolGood) {
|
||||
std::string spirv = R"(
|
||||
OpCapability RayTracingNV
|
||||
|
Loading…
Reference in New Issue
Block a user