mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 21:30:07 +00:00
spirv-val: Add Vulkan decroation VUID (#4090)
This commit is contained in:
parent
4ed1f4fce9
commit
aa005e8bd4
@ -219,6 +219,16 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) {
|
||||
<< "' is not valid for the WebGPU execution environment.";
|
||||
}
|
||||
|
||||
if (spvIsVulkanEnv(_.context()->target_env)) {
|
||||
if ((decoration == SpvDecorationGLSLShared) ||
|
||||
(decoration == SpvDecorationGLSLPacked)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< _.VkErrorID(4669) << "OpDecorate decoration '"
|
||||
<< LogStringForDecoration(decoration)
|
||||
<< "' is not valid for the Vulkan execution environment.";
|
||||
}
|
||||
}
|
||||
|
||||
if (DecorationTakesIdParameters(decoration)) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "Decorations taking ID parameters may not be used with "
|
||||
|
@ -1671,6 +1671,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpTypeImage-04656);
|
||||
case 4658:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpImageTexelPointer-04658);
|
||||
case 4669:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-GLSLShared-04669);
|
||||
case 4675:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-FPRoundingMode-04675);
|
||||
case 4685:
|
||||
|
@ -44,6 +44,8 @@ struct TestResult {
|
||||
using ValidateDecorations = spvtest::ValidateBase<bool>;
|
||||
using ValidateWebGPUCombineDecorationResult =
|
||||
spvtest::ValidateBase<std::tuple<const char*, TestResult>>;
|
||||
using ValidateVulkanCombineDecorationResult =
|
||||
spvtest::ValidateBase<std::tuple<const char*, const char*, TestResult>>;
|
||||
|
||||
TEST_F(ValidateDecorations, ValidateOpDecorateRegistration) {
|
||||
std::string spirv = R"(
|
||||
@ -6449,6 +6451,40 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
SPV_ERROR_INVALID_ID,
|
||||
"is not valid for the WebGPU execution environment."))));
|
||||
|
||||
TEST_P(ValidateVulkanCombineDecorationResult, Decorate) {
|
||||
const char* const decoration = std::get<0>(GetParam());
|
||||
const char* const vuid = std::get<1>(GetParam());
|
||||
const TestResult& test_result = std::get<2>(GetParam());
|
||||
|
||||
CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
|
||||
generator.before_types_ = "OpDecorate %u32 ";
|
||||
generator.before_types_ += decoration;
|
||||
generator.before_types_ += "\n";
|
||||
|
||||
EntryPoint entry_point;
|
||||
entry_point.name = "main";
|
||||
entry_point.execution_model = "Vertex";
|
||||
generator.entry_points_.push_back(std::move(entry_point));
|
||||
|
||||
CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(test_result.validation_result,
|
||||
ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
if (test_result.error_str != "") {
|
||||
EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str));
|
||||
}
|
||||
if (vuid) {
|
||||
EXPECT_THAT(getDiagnosticString(), AnyVUID(vuid));
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
DecorationAllowListFailure, ValidateVulkanCombineDecorationResult,
|
||||
Combine(Values("GLSLShared", "GLSLPacked"),
|
||||
Values("VUID-StandaloneSpirv-GLSLShared-04669"),
|
||||
Values(TestResult(
|
||||
SPV_ERROR_INVALID_ID,
|
||||
"is not valid for the Vulkan execution environment."))));
|
||||
|
||||
TEST_F(ValidateDecorations, NonWritableVarFunctionV13Bad) {
|
||||
std::string spirv = ShaderWithNonWritableTarget("%var_func");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user