mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-12 09:20:15 +00:00
parent
0c4feb643b
commit
3a252a267b
@ -229,12 +229,12 @@ spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst,
|
||||
|
||||
// WebGPU specific rules
|
||||
if (spvIsWebGPUEnv(_.context()->target_env)) {
|
||||
if (value != SpvScopeWorkgroup && value != SpvScopeSubgroup &&
|
||||
if (value != SpvScopeWorkgroup && value != SpvScopeInvocation &&
|
||||
value != SpvScopeQueueFamilyKHR) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< spvOpcodeString(opcode)
|
||||
<< ": in WebGPU environment Memory Scope is limited to "
|
||||
<< "Workgroup, Subgroup and QueuFamilyKHR";
|
||||
<< "Workgroup, Invocation, and QueueFamilyKHR";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ TEST_F(ValidateAtomics, AtomicLoadWebGPUNonRelaxedFailure) {
|
||||
|
||||
TEST_F(ValidateAtomics, AtomicLoadWebGPUSequentiallyConsistentFailure) {
|
||||
const std::string body = R"(
|
||||
%val3 = OpAtomicLoad %u32 %u32_var %subgroup %sequentially_consistent
|
||||
%val3 = OpAtomicLoad %u32 %u32_var %invocation %sequentially_consistent
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateWebGPUShaderCode(body), SPV_ENV_WEBGPU_0);
|
||||
@ -1916,7 +1916,7 @@ TEST_F(ValidateAtomics, WebGPUCrossDeviceMemoryScopeBad) {
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("AtomicLoad: in WebGPU environment Memory Scope is limited to "
|
||||
"Workgroup, Subgroup and QueuFamilyKHR\n"
|
||||
"Workgroup, Invocation, and QueueFamilyKHR\n"
|
||||
" %34 = OpAtomicLoad %uint %29 %uint_0_0 %uint_0_1\n"));
|
||||
}
|
||||
|
||||
@ -1930,7 +1930,7 @@ TEST_F(ValidateAtomics, WebGPUDeviceMemoryScopeBad) {
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("AtomicLoad: in WebGPU environment Memory Scope is limited to "
|
||||
"Workgroup, Subgroup and QueuFamilyKHR\n"
|
||||
"Workgroup, Invocation, and QueueFamilyKHR\n"
|
||||
" %34 = OpAtomicLoad %uint %29 %uint_1_0 %uint_0_1\n"));
|
||||
}
|
||||
|
||||
@ -1943,18 +1943,9 @@ TEST_F(ValidateAtomics, WebGPUWorkgroupMemoryScopeGood) {
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_WEBGPU_0));
|
||||
}
|
||||
|
||||
TEST_F(ValidateAtomics, WebGPUSubgroupMemoryScopeGood) {
|
||||
TEST_F(ValidateAtomics, WebGPUSubgroupMemoryScopeBad) {
|
||||
const std::string body = R"(
|
||||
%val1 = OpAtomicLoad %u32 %u32_var %subgroup %relaxed
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateWebGPUShaderCode(body), SPV_ENV_WEBGPU_0);
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_WEBGPU_0));
|
||||
}
|
||||
|
||||
TEST_F(ValidateAtomics, WebGPUInvocationMemoryScopeBad) {
|
||||
const std::string body = R"(
|
||||
%val1 = OpAtomicLoad %u32 %u32_var %invocation %relaxed
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateWebGPUShaderCode(body), SPV_ENV_WEBGPU_0);
|
||||
@ -1962,8 +1953,17 @@ TEST_F(ValidateAtomics, WebGPUInvocationMemoryScopeBad) {
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("AtomicLoad: in WebGPU environment Memory Scope is limited to "
|
||||
"Workgroup, Subgroup and QueuFamilyKHR\n"
|
||||
" %34 = OpAtomicLoad %uint %29 %uint_4 %uint_0_1\n"));
|
||||
"Workgroup, Invocation, and QueueFamilyKHR\n"
|
||||
" %34 = OpAtomicLoad %uint %29 %uint_3 %uint_0_1\n"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateAtomics, WebGPUInvocationMemoryScopeGood) {
|
||||
const std::string body = R"(
|
||||
%val1 = OpAtomicLoad %u32 %u32_var %invocation %relaxed
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateWebGPUShaderCode(body), SPV_ENV_WEBGPU_0);
|
||||
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_WEBGPU_0));
|
||||
}
|
||||
|
||||
TEST_F(ValidateAtomics, WebGPUQueueFamilyMemoryScopeGood) {
|
||||
|
Loading…
Reference in New Issue
Block a user