spirv-val: Label 06807 and 06808 VUID (#4817)
diff --git a/source/val/validate_memory.cpp b/source/val/validate_memory.cpp
index cfdea73..ee053f8 100644
--- a/source/val/validate_memory.cpp
+++ b/source/val/validate_memory.cpp
@@ -524,8 +524,8 @@
if (storage_class == SpvStorageClassPushConstant) {
if (pointee->opcode() != SpvOpTypeStruct) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
- << "PushConstant OpVariable <id> '" << _.getIdName(inst->id())
- << "' has illegal type.\n"
+ << _.VkErrorID(6808) << "PushConstant OpVariable <id> '"
+ << _.getIdName(inst->id()) << "' has illegal type.\n"
<< "From Vulkan spec, Push Constant Interface section:\n"
<< "Such variables must be typed as OpTypeStruct";
}
@@ -552,9 +552,9 @@
if (storage_class == SpvStorageClassUniform) {
if (!IsAllowedTypeOrArrayOfSame(_, pointee, {SpvOpTypeStruct})) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
- << "Uniform OpVariable <id> '" << _.getIdName(inst->id())
- << "' has illegal type.\n"
- << "From Vulkan spec, section 14.5.2:\n"
+ << _.VkErrorID(6807) << "Uniform OpVariable <id> '"
+ << _.getIdName(inst->id()) << "' has illegal type.\n"
+ << "From Vulkan spec:\n"
<< "Variables identified with the Uniform storage class are "
<< "used to access transparent buffer backed resources. Such "
<< "variables must be typed as OpTypeStruct, or an array of "
@@ -565,9 +565,9 @@
if (storage_class == SpvStorageClassStorageBuffer) {
if (!IsAllowedTypeOrArrayOfSame(_, pointee, {SpvOpTypeStruct})) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
- << "StorageBuffer OpVariable <id> '" << _.getIdName(inst->id())
- << "' has illegal type.\n"
- << "From Vulkan spec, section 14.5.2:\n"
+ << _.VkErrorID(6807) << "StorageBuffer OpVariable <id> '"
+ << _.getIdName(inst->id()) << "' has illegal type.\n"
+ << "From Vulkan spec:\n"
<< "Variables identified with the StorageBuffer storage class "
"are used to access transparent buffer backed resources. "
"Such variables must be typed as OpTypeStruct, or an array "
diff --git a/source/val/validation_state.cpp b/source/val/validation_state.cpp
index d9422b2..1b41f1e 100644
--- a/source/val/validation_state.cpp
+++ b/source/val/validation_state.cpp
@@ -1941,6 +1941,10 @@
return VUID_WRAP(VUID-StandaloneSpirv-PerVertexKHR-06777);
case 6778:
return VUID_WRAP(VUID-StandaloneSpirv-Input-06778);
+ case 6807:
+ return VUID_WRAP(VUID-StandaloneSpirv-Uniform-06807);
+ case 6808:
+ return VUID_WRAP(VUID-StandaloneSpirv-PushConstant-06808);
default:
return ""; // unknown id
}
diff --git a/test/val/val_memory_test.cpp b/test/val/val_memory_test.cpp
index 5fb43f7..5d24fa5 100644
--- a/test/val/val_memory_test.cpp
+++ b/test/val/val_memory_test.cpp
@@ -203,9 +203,11 @@
)";
CompileSuccessfully(src, SPV_ENV_VULKAN_1_1);
ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\n"
+ HasSubstr("From Vulkan spec:\n"
"Variables identified with the Uniform storage class are used "
"to access transparent buffer backed resources. Such variables "
"must be typed as OpTypeStruct, or an array of this type"));
@@ -277,9 +279,11 @@
)";
CompileSuccessfully(src, SPV_ENV_VULKAN_1_1);
ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\n"
+ HasSubstr("From Vulkan spec:\n"
"Variables identified with the Uniform storage class are used "
"to access transparent buffer backed resources. Such variables "
"must be typed as OpTypeStruct, or an array of this type"));
@@ -318,9 +322,11 @@
)";
CompileSuccessfully(src, SPV_ENV_VULKAN_1_1);
ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\n"
+ HasSubstr("From Vulkan spec:\n"
"Variables identified with the Uniform storage class are used "
"to access transparent buffer backed resources. Such variables "
"must be typed as OpTypeStruct, or an array of this type"));
@@ -833,6 +839,8 @@
)";
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-PushConstant-06808"));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("PushConstant OpVariable <id> '6[%6]' has illegal "
@@ -867,6 +875,8 @@
)";
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_1);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-PushConstant-06808"));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("PushConstant OpVariable <id> '10[%10]' has illegal "
@@ -4212,9 +4222,11 @@
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\nVariables identified with "
+ HasSubstr("From Vulkan spec:\nVariables identified with "
"the StorageBuffer storage class are used to access "
"transparent buffer backed resources. Such variables must be "
"typed as OpTypeStruct, or an array of this type"));
@@ -4243,9 +4255,11 @@
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\nVariables identified with "
+ HasSubstr("From Vulkan spec:\nVariables identified with "
"the StorageBuffer storage class are used to access "
"transparent buffer backed resources. Such variables must be "
"typed as OpTypeStruct, or an array of this type"));
@@ -4273,9 +4287,11 @@
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0));
+ EXPECT_THAT(getDiagnosticString(),
+ AnyVUID("VUID-StandaloneSpirv-Uniform-06807"));
EXPECT_THAT(
getDiagnosticString(),
- HasSubstr("From Vulkan spec, section 14.5.2:\nVariables identified with "
+ HasSubstr("From Vulkan spec:\nVariables identified with "
"the StorageBuffer storage class are used to access "
"transparent buffer backed resources. Such variables must be "
"typed as OpTypeStruct, or an array of this type"));