mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-30 06:50:06 +00:00
spirv-val: Vulkan 64-bit OpAtomicStore check (#4163)
This commit is contained in:
parent
e6a9f4e430
commit
c6da5e343c
@ -225,6 +225,16 @@ spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) {
|
|||||||
"be: Uniform, Workgroup, Image, StorageBuffer, or "
|
"be: Uniform, Workgroup, Image, StorageBuffer, or "
|
||||||
"PhysicalStorageBuffer.";
|
"PhysicalStorageBuffer.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can't use result_type because OpAtomicStore doesn't have a result
|
||||||
|
if (opcode == SpvOpAtomicStore && _.GetBitWidth(data_type) == 64 &&
|
||||||
|
_.IsIntScalarType(data_type) &&
|
||||||
|
!_.HasCapability(SpvCapabilityInt64Atomics)) {
|
||||||
|
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||||
|
<< spvOpcodeString(opcode)
|
||||||
|
<< ": 64-bit atomics require the Int64Atomics "
|
||||||
|
"capability";
|
||||||
|
}
|
||||||
} else if (storage_class == SpvStorageClassFunction) {
|
} else if (storage_class == SpvStorageClassFunction) {
|
||||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||||
<< spvOpcodeString(opcode)
|
<< spvOpcodeString(opcode)
|
||||||
|
@ -537,6 +537,19 @@ TEST_F(ValidateAtomics, AtomicLoadVulkanInt64) {
|
|||||||
"AtomicLoad: 64-bit atomics require the Int64Atomics capability"));
|
"AtomicLoad: 64-bit atomics require the Int64Atomics capability"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ValidateAtomics, AtomicStoreVulkanInt64) {
|
||||||
|
const std::string body = R"(
|
||||||
|
OpAtomicStore %u64_var %device %relaxed %u64_1
|
||||||
|
)";
|
||||||
|
|
||||||
|
CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0);
|
||||||
|
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||||
|
EXPECT_THAT(
|
||||||
|
getDiagnosticString(),
|
||||||
|
HasSubstr(
|
||||||
|
"AtomicStore: 64-bit atomics require the Int64Atomics capability"));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ValidateAtomics, VK_KHR_shader_atomic_int64Success) {
|
TEST_F(ValidateAtomics, VK_KHR_shader_atomic_int64Success) {
|
||||||
const std::string body = R"(
|
const std::string body = R"(
|
||||||
%val1 = OpAtomicUMin %u64 %u64_var %device %relaxed %u64_1
|
%val1 = OpAtomicUMin %u64 %u64_var %device %relaxed %u64_1
|
||||||
|
Loading…
Reference in New Issue
Block a user