mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-12-24 00:40:14 +00:00
spirv-val: Add Vulkan Image VUID 06214 (#4750)
This commit is contained in:
parent
9700708570
commit
5c9d55a59a
@ -869,13 +869,21 @@ spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) {
|
||||
if (info.dim == SpvDimSubpassData) {
|
||||
if (info.sampled != 2) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Dim SubpassData requires Sampled to be 2";
|
||||
<< _.VkErrorID(6214) << "Dim SubpassData requires Sampled to be 2";
|
||||
}
|
||||
|
||||
if (info.format != SpvImageFormatUnknown) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Dim SubpassData requires format Unknown";
|
||||
}
|
||||
|
||||
if (spvIsVulkanEnv(target_env)) {
|
||||
if (info.arrayed != 0) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< _.VkErrorID(6214)
|
||||
<< "Dim SubpassData requires Arrayed to be 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Format and Access Qualifier are also checked elsewhere.
|
||||
|
@ -1898,6 +1898,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 6214:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpTypeImage-06214);
|
||||
case 6491:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-DescriptorSet-06491);
|
||||
default:
|
||||
|
@ -738,6 +738,34 @@ TEST_F(ValidateImage, TypeImageWrongSampledForSubpassData) {
|
||||
HasSubstr("Dim SubpassData requires Sampled to be 2"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateImage, TypeImageWrongSampledForSubpassDataVulkan) {
|
||||
const std::string code = GetShaderHeader("OpCapability InputAttachment\n") +
|
||||
R"(
|
||||
%img_type = OpTypeImage %f32 SubpassData 0 0 0 1 Unknown
|
||||
)" + TrivialMain();
|
||||
|
||||
CompileSuccessfully(code.c_str());
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpTypeImage-06214"));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("Dim SubpassData requires Sampled to be 2"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateImage, TypeImageWrongArrayForSubpassDataVulkan) {
|
||||
const std::string code = GetShaderHeader("OpCapability InputAttachment\n") +
|
||||
R"(
|
||||
%img_type = OpTypeImage %f32 SubpassData 0 1 0 2 Unknown
|
||||
)" + TrivialMain();
|
||||
|
||||
CompileSuccessfully(code.c_str());
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpTypeImage-06214"));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("Dim SubpassData requires Arrayed to be 0"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateImage, TypeImage_OpenCL_Sampled0_OK) {
|
||||
const std::string code = GetKernelHeader() + R"(
|
||||
%img_type = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
|
||||
|
Loading…
Reference in New Issue
Block a user