spirv-val: Label VUID 06491 (#4745)

This commit is contained in:
sfricke-samsung 2022-03-07 11:30:05 -06:00 committed by GitHub
parent 0b8426346d
commit 273d2a45ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -326,17 +326,20 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec,
case SpvDecorationLocation:
case SpvDecorationComponent:
// Location is used for input, output and ray tracing stages.
if (sc == SpvStorageClassStorageBuffer ||
sc == SpvStorageClassUniform ||
sc == SpvStorageClassUniformConstant ||
sc == SpvStorageClassWorkgroup || sc == SpvStorageClassPrivate ||
sc == SpvStorageClassFunction) {
if (sc != SpvStorageClassInput && sc != SpvStorageClassOutput &&
sc != SpvStorageClassRayPayloadKHR &&
sc != SpvStorageClassIncomingRayPayloadKHR &&
sc != SpvStorageClassHitAttributeKHR &&
sc != SpvStorageClassCallableDataKHR &&
sc != SpvStorageClassIncomingCallableDataKHR &&
sc != SpvStorageClassShaderRecordBufferKHR) {
return _.diag(SPV_ERROR_INVALID_ID, target)
<< LogStringForDecoration(dec)
<< " decoration must not be applied to this storage class";
}
break;
case SpvDecorationIndex:
// Langauge from SPIR-V definition of Index
if (sc != SpvStorageClassOutput) {
return fail(0) << "must be in the Output storage class";
}
@ -346,8 +349,8 @@ spv_result_t ValidateDecorationTarget(ValidationState_t& _, SpvDecoration dec,
if (sc != SpvStorageClassStorageBuffer &&
sc != SpvStorageClassUniform &&
sc != SpvStorageClassUniformConstant) {
return fail(0) << "must be in the StorageBuffer, Uniform, or "
"UniformConstant storage class";
return fail(6491) << "must be in the StorageBuffer, Uniform, or "
"UniformConstant storage class";
}
break;
case SpvDecorationInputAttachmentIndex:

View File

@ -1896,6 +1896,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
return VUID_WRAP(VUID-StandaloneSpirv-Location-04918);
case 4919:
return VUID_WRAP(VUID-StandaloneSpirv-Location-04919);
case 6491:
return VUID_WRAP(VUID-StandaloneSpirv-DescriptorSet-06491);
default:
return ""; // unknown id
}

View File

@ -793,6 +793,8 @@ OpFunctionEnd
CompileSuccessfully(text, SPV_ENV_VULKAN_1_0);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("VUID-StandaloneSpirv-DescriptorSet-06491"));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("must be in the StorageBuffer, Uniform, or "
"UniformConstant storage class"));