Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Fricke <spencerfricke@gmail.com>2022-09-16 21:05:40 +0300
committerGitHub <noreply@github.com>2022-09-16 21:05:40 +0300
commit5f4ce362ad45b0813de5706377ebde188f7d9a6b (patch)
tree589fe7cc06c15eacef3d51bbe112af73367ee015
parent8422d8a44b208ecdd124b28fefc84b9373cf4359 (diff)
spirv-val: Label VUID 07290 (#4927)
-rw-r--r--source/val/validate_memory.cpp1
-rw-r--r--source/val/validation_state.cpp2
-rw-r--r--test/val/val_id_test.cpp29
3 files changed, 32 insertions, 0 deletions
diff --git a/source/val/validate_memory.cpp b/source/val/validate_memory.cpp
index e4ad0e027..f939542f4 100644
--- a/source/val/validate_memory.cpp
+++ b/source/val/validate_memory.cpp
@@ -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";
diff --git a/source/val/validation_state.cpp b/source/val/validation_state.cpp
index 218369506..d826acd4f 100644
--- a/source/val/validation_state.cpp
+++ b/source/val/validation_state.cpp
@@ -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
}
diff --git a/test/val/val_id_test.cpp b/test/val/val_id_test.cpp
index a5f315c98..3cf7575a1 100644
--- a/test/val/val_id_test.cpp
+++ b/test/val/val_id_test.cpp
@@ -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