mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-30 06:50:06 +00:00
spirv-val: Label Vulkan atomic semantics VUIDs (#4120)
This commit is contained in:
parent
819117cd48
commit
a61600c763
@ -172,7 +172,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _,
|
||||
|
||||
if (opcode == SpvOpMemoryBarrier && !num_memory_order_set_bits) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< _.VkErrorID(4649) << spvOpcodeString(opcode)
|
||||
<< _.VkErrorID(4732) << spvOpcodeString(opcode)
|
||||
<< ": Vulkan specification requires Memory Semantics to have "
|
||||
"one "
|
||||
"of the following bits set: Acquire, Release, "
|
||||
@ -182,7 +182,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _,
|
||||
|
||||
if (opcode == SpvOpMemoryBarrier && !includes_storage_class) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< _.VkErrorID(4649) << spvOpcodeString(opcode)
|
||||
<< _.VkErrorID(4733) << spvOpcodeString(opcode)
|
||||
<< ": expected Memory Semantics to include a Vulkan-supported "
|
||||
"storage class";
|
||||
}
|
||||
@ -223,6 +223,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _,
|
||||
value & SpvMemorySemanticsAcquireReleaseMask ||
|
||||
value & SpvMemorySemanticsSequentiallyConsistentMask)) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< _.VkErrorID(4731)
|
||||
<< "Vulkan spec disallows OpAtomicLoad with Memory Semantics "
|
||||
"Release, AcquireRelease and SequentiallyConsistent";
|
||||
}
|
||||
@ -232,6 +233,7 @@ spv_result_t ValidateMemorySemantics(ValidationState_t& _,
|
||||
value & SpvMemorySemanticsAcquireReleaseMask ||
|
||||
value & SpvMemorySemanticsSequentiallyConsistentMask)) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< _.VkErrorID(4730)
|
||||
<< "Vulkan spec disallows OpAtomicStore with Memory Semantics "
|
||||
"Acquire, AcquireRelease and SequentiallyConsistent";
|
||||
}
|
||||
|
@ -1684,8 +1684,6 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04640);
|
||||
case 4642:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04642);
|
||||
case 4649:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04649);
|
||||
case 4651:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpVariable-04651);
|
||||
case 4652:
|
||||
@ -1714,6 +1712,14 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04686);
|
||||
case 4711:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpTypeForwardPointer-04711);
|
||||
case 4730:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpAtomicStore-04730);
|
||||
case 4731:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpAtomicLoad-04731);
|
||||
case 4732:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04732);
|
||||
case 4733:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpMemoryBarrier-04733);
|
||||
default:
|
||||
return ""; // unknown id
|
||||
};
|
||||
|
@ -477,6 +477,8 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanRelease) {
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics "
|
||||
@ -490,6 +492,8 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanAcquireRelease) {
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics "
|
||||
@ -503,6 +507,8 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanSequentiallyConsistent) {
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicLoad-04731"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics "
|
||||
@ -675,6 +681,8 @@ OpAtomicStore %u32_var %device %acquire %u32_1
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics "
|
||||
@ -688,6 +696,8 @@ OpAtomicStore %u32_var %device %acquire_release %u32_1
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics "
|
||||
@ -701,6 +711,8 @@ OpAtomicStore %u32_var %device %sequentially_consistent %u32_1
|
||||
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpAtomicStore-04730"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics "
|
||||
|
@ -721,7 +721,7 @@ OpMemoryBarrier %device %none
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04649"));
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04732"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("MemoryBarrier: Vulkan specification requires Memory Semantics "
|
||||
@ -737,7 +737,7 @@ OpMemoryBarrier %device %acquire
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04649"));
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04733"));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("MemoryBarrier: expected Memory Semantics to include a "
|
||||
"Vulkan-supported storage class"));
|
||||
@ -751,7 +751,7 @@ OpMemoryBarrier %device %acquire_release_subgroup
|
||||
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04649"));
|
||||
AnyVUID("VUID-StandaloneSpirv-OpMemoryBarrier-04733"));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("MemoryBarrier: expected Memory Semantics to include a "
|
||||
"Vulkan-supported storage class"));
|
||||
|
Loading…
Reference in New Issue
Block a user