spirv-val: Fix SPV_KHR_fragment_shading_rate VUID label (#4014)

in 3943 the new tests should have failed, but didn't due to the AnyVUID
check not handling case with trailing whitespace. Added trimming to handle
it as easily might happen again in future
This commit is contained in:
sfricke-samsung 2020-11-05 10:04:47 -08:00 коммит произвёл GitHub
Родитель 650acb575b
Коммит a61d07a727
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -1491,6 +1491,18 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
return VUID_WRAP(VUID-WorkgroupSize-WorkgroupSize-04426);
case 4427:
return VUID_WRAP(VUID-WorkgroupSize-WorkgroupSize-04427);
case 4484:
return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04484);
case 4485:
return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04485);
case 4486:
return VUID_WRAP(VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04486);
case 4490:
return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04490);
case 4491:
return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04491);
case 4492:
return VUID_WRAP(VUID-ShadingRateKHR-ShadingRateKHR-04492);
default:
return ""; // unknown id
};

Просмотреть файл

@ -168,6 +168,17 @@ MATCHER_P(AnyVUID, vuid_set, "VUID from the set is in error message") {
std::string token;
std::string vuids = std::string(vuid_set);
size_t position;
// Catch case were someone accidentally left spaces by trimming string
// clang-format off
vuids.erase(std::find_if(vuids.rbegin(), vuids.rend(), [](unsigned char c) {
return (c != ' ');
}).base(), vuids.end());
vuids.erase(vuids.begin(), std::find_if(vuids.begin(), vuids.end(), [](unsigned char c) {
return (c != ' ');
}));
// clang-format on
do {
position = vuids.find(delimiter);
if (position != std::string::npos) {
@ -3838,7 +3849,7 @@ INSTANTIATE_TEST_SUITE_P(
Values("PrimitiveShadingRateKHR"), Values("Vertex"), Values("Output"),
Values("%f32"), Values("OpCapability FragmentShadingRateKHR\n"),
Values("OpExtension \"SPV_KHR_fragment_shading_rate\"\n"),
Values("VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04485 "),
Values("VUID-PrimitiveShadingRateKHR-PrimitiveShadingRateKHR-04486 "),
Values(TestResult(
SPV_ERROR_INVALID_DATA,
"According to the Vulkan spec BuiltIn PrimitiveShadingRateKHR "