Skip to content

Commit 27dd301

Browse files
spirv-val: Label maintenance9 new VUID (KhronosGroup#6176)
1 parent e9a8cee commit 27dd301

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

include/spirv-tools/libspirv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetAllowOffsetTextureOperand(
771771
spv_validator_options options, bool val);
772772

773773
// Allow base operands of some bit operations to be non-32-bit wide.
774+
// Was added for VK_KHR_maintenance9
774775
SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetAllowVulkan32BitBitwise(
775776
spv_validator_options options, bool val);
776777

include/spirv-tools/libspirv.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class SPIRV_TOOLS_EXPORT ValidatorOptions {
133133
}
134134

135135
// Allow base operands of some bit operations to be non-32-bit wide.
136+
// Was added for VK_KHR_maintenance9
136137
void SetAllowVulkan32BitBitwise(bool val) {
137138
spvValidatorOptionsSetAllowVulkan32BitBitwise(options_, val);
138139
}

source/val/validate_bitwise.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ spv_result_t ValidateBaseType(ValidationState_t& _, const Instruction* inst,
3939
if (_.GetBitWidth(base_type) != 32 &&
4040
!_.options()->allow_vulkan_32_bit_bitwise) {
4141
return _.diag(SPV_ERROR_INVALID_DATA, inst)
42-
<< _.VkErrorID(4781)
42+
<< _.VkErrorID(10824)
4343
<< "Expected 32-bit int type for Base operand: "
44-
<< spvOpcodeString(opcode);
44+
<< spvOpcodeString(opcode)
45+
<< _.MissingFeature("maintenance9 feature",
46+
"--allow-vulkan-32-bit-bitwise", false);
4547
}
4648
}
4749

source/val/validation_state.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,8 +2493,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
24932493
return VUID_WRAP(VUID-StandaloneSpirv-OpImage-04777);
24942494
case 4780:
24952495
return VUID_WRAP(VUID-StandaloneSpirv-Result-04780);
2496-
case 4781:
2497-
return VUID_WRAP(VUID-StandaloneSpirv-Base-04781);
24982496
case 4915:
24992497
return VUID_WRAP(VUID-StandaloneSpirv-Location-04915);
25002498
case 4916:
@@ -2640,6 +2638,9 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
26402638
return VUID_WRAP(VUID-StandaloneSpirv-None-10684);
26412639
case 10685:
26422640
return VUID_WRAP(VUID-StandaloneSpirv-None-10685);
2641+
case 10824:
2642+
// This use to be a standalone, but maintenance9 will set allow_vulkan_32_bit_bitwise now
2643+
return VUID_WRAP(VUID-RuntimeSpirv-None-10824);
26432644
default:
26442645
return ""; // unknown id
26452646
}

test/val/val_bitwise_test.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,7 @@ TEST_F(ValidateBitwise, OpBitFieldInsertNot32Vulkan) {
420420

421421
CompileSuccessfully(GenerateShaderCode(body).c_str(), SPV_ENV_VULKAN_1_0);
422422
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
423-
EXPECT_THAT(getDiagnosticString(),
424-
AnyVUID("VUID-StandaloneSpirv-Base-04781"));
423+
EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-RuntimeSpirv-None-10824"));
425424
EXPECT_THAT(
426425
getDiagnosticString(),
427426
HasSubstr("Expected 32-bit int type for Base operand: BitFieldInsert"));
@@ -514,8 +513,7 @@ TEST_F(ValidateBitwise, OpBitFieldSExtractNot32Vulkan) {
514513

515514
CompileSuccessfully(GenerateShaderCode(body).c_str(), SPV_ENV_VULKAN_1_0);
516515
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
517-
EXPECT_THAT(getDiagnosticString(),
518-
AnyVUID("VUID-StandaloneSpirv-Base-04781"));
516+
EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-RuntimeSpirv-None-10824"));
519517
EXPECT_THAT(
520518
getDiagnosticString(),
521519
HasSubstr("Expected 32-bit int type for Base operand: BitFieldSExtract"));
@@ -572,8 +570,7 @@ TEST_F(ValidateBitwise, OpBitReverseNot32Vulkan) {
572570

573571
CompileSuccessfully(GenerateShaderCode(body).c_str(), SPV_ENV_VULKAN_1_0);
574572
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
575-
EXPECT_THAT(getDiagnosticString(),
576-
AnyVUID("VUID-StandaloneSpirv-Base-04781"));
573+
EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-RuntimeSpirv-None-10824"));
577574
EXPECT_THAT(
578575
getDiagnosticString(),
579576
HasSubstr("Expected 32-bit int type for Base operand: BitReverse"));
@@ -645,8 +642,7 @@ TEST_F(ValidateBitwise, OpBitCountNot32Vulkan) {
645642

646643
CompileSuccessfully(GenerateShaderCode(body).c_str(), SPV_ENV_VULKAN_1_0);
647644
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
648-
EXPECT_THAT(getDiagnosticString(),
649-
AnyVUID("VUID-StandaloneSpirv-Base-04781"));
645+
EXPECT_THAT(getDiagnosticString(), AnyVUID("VUID-RuntimeSpirv-None-10824"));
650646
EXPECT_THAT(getDiagnosticString(),
651647
HasSubstr("Expected 32-bit int type for Base operand: BitCount"));
652648
}

0 commit comments

Comments
 (0)