spirv-val: Label ShaderRecordBufferKHR VUID (#4926)

This commit is contained in:
Spencer Fricke 2022-09-17 03:05:23 +09:00 committed by GitHub
parent c3f844aec4
commit 8422d8a44b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -744,9 +744,10 @@ void ValidationState_t::RegisterStorageClassConsumer(
return true; return true;
}); });
} else if (storage_class == SpvStorageClassShaderRecordBufferKHR) { } else if (storage_class == SpvStorageClassShaderRecordBufferKHR) {
std::string errorVUID = VkErrorID(7119);
function(consumer->function()->id()) function(consumer->function()->id())
->RegisterExecutionModelLimitation( ->RegisterExecutionModelLimitation(
[](SpvExecutionModel model, std::string* message) { [errorVUID](SpvExecutionModel model, std::string* message) {
if (model != SpvExecutionModelRayGenerationKHR && if (model != SpvExecutionModelRayGenerationKHR &&
model != SpvExecutionModelIntersectionKHR && model != SpvExecutionModelIntersectionKHR &&
model != SpvExecutionModelAnyHitKHR && model != SpvExecutionModelAnyHitKHR &&
@ -755,6 +756,7 @@ void ValidationState_t::RegisterStorageClassConsumer(
model != SpvExecutionModelMissKHR) { model != SpvExecutionModelMissKHR) {
if (message) { if (message) {
*message = *message =
errorVUID +
"ShaderRecordBufferKHR Storage Class is limited to " "ShaderRecordBufferKHR Storage Class is limited to "
"RayGenerationKHR, IntersectionKHR, AnyHitKHR, " "RayGenerationKHR, IntersectionKHR, AnyHitKHR, "
"ClosestHitKHR, CallableKHR, and MissKHR execution model"; "ClosestHitKHR, CallableKHR, and MissKHR execution model";
@ -2038,6 +2040,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
return VUID_WRAP(VUID-StandaloneSpirv-CallableDataKHR-04704); return VUID_WRAP(VUID-StandaloneSpirv-CallableDataKHR-04704);
case 4705: case 4705:
return VUID_WRAP(VUID-StandaloneSpirv-IncomingCallableDataKHR-04705); return VUID_WRAP(VUID-StandaloneSpirv-IncomingCallableDataKHR-04705);
case 7119:
return VUID_WRAP(VUID-StandaloneSpirv-ShaderRecordBufferKHR-07119);
case 4708: case 4708:
return VUID_WRAP(VUID-StandaloneSpirv-PhysicalStorageBuffer64-04708); return VUID_WRAP(VUID-StandaloneSpirv-PhysicalStorageBuffer64-04708);
case 4710: case 4710:

View File

@ -544,6 +544,8 @@ TEST_P(ValidateStorageExecutionModel, ShaderRecordBufferLoad) {
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2)); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_2));
} else { } else {
ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2)); ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_2));
EXPECT_THAT(getDiagnosticString(),
AnyVUID("VUID-StandaloneSpirv-ShaderRecordBufferKHR-07119"));
EXPECT_THAT( EXPECT_THAT(
getDiagnosticString(), getDiagnosticString(),
HasSubstr("ShaderRecordBufferKHR Storage Class is limited to " HasSubstr("ShaderRecordBufferKHR Storage Class is limited to "