spirv-val: Label VUID 07290 (#4927)
diff --git a/source/val/validate_memory.cpp b/source/val/validate_memory.cpp
index e4ad0e0..f939542 100644
--- a/source/val/validate_memory.cpp
+++ b/source/val/validate_memory.cpp
@@ -459,6 +459,7 @@
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";
diff --git a/source/val/validation_state.cpp b/source/val/validation_state.cpp
index 2183695..d826acd 100644
--- a/source/val/validation_state.cpp
+++ b/source/val/validation_state.cpp
@@ -2110,6 +2110,8 @@
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
}
diff --git a/test/val/val_id_test.cpp b/test/val/val_id_test.cpp
index a5f315c..3cf7575 100644
--- a/test/val/val_id_test.cpp
+++ b/test/val/val_id_test.cpp
@@ -2278,6 +2278,35 @@
"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