mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 13:20:05 +00:00
parent
b1ff15f220
commit
b75f4362f0
@ -412,6 +412,21 @@ spv_result_t ValidateExecutionMode(ValidationState_t& _,
|
||||
}
|
||||
}
|
||||
|
||||
if (spvIsWebGPUEnv(_.context()->target_env)) {
|
||||
if (mode != SpvExecutionModeOriginUpperLeft &&
|
||||
mode != SpvExecutionModeDepthReplacing &&
|
||||
mode != SpvExecutionModeDepthGreater &&
|
||||
mode != SpvExecutionModeDepthLess &&
|
||||
mode != SpvExecutionModeDepthUnchanged &&
|
||||
mode != SpvExecutionModeLocalSize &&
|
||||
mode != SpvExecutionModeLocalSizeHint) {
|
||||
return _.diag(SPV_ERROR_INVALID_DATA, inst)
|
||||
<< "Execution mode must be one of OriginUpperLeft, "
|
||||
"DepthReplacing, DepthGreater, DepthLess, DepthUnchanged, "
|
||||
"LocalSize, or LocalSizeHint for WebGPU environment.";
|
||||
}
|
||||
}
|
||||
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -531,16 +531,24 @@ TEST_P(ValidateModeExecution, ExecutionMode) {
|
||||
|
||||
std::ostringstream sstr;
|
||||
sstr << "OpCapability Shader\n";
|
||||
sstr << "OpCapability Geometry\n";
|
||||
sstr << "OpCapability Tessellation\n";
|
||||
sstr << "OpCapability TransformFeedback\n";
|
||||
if (!spvIsVulkanEnv(env)) {
|
||||
if (!spvIsWebGPUEnv(env)) {
|
||||
sstr << "OpCapability Geometry\n";
|
||||
sstr << "OpCapability Tessellation\n";
|
||||
sstr << "OpCapability TransformFeedback\n";
|
||||
}
|
||||
if (!spvIsVulkanOrWebGPUEnv(env)) {
|
||||
sstr << "OpCapability Kernel\n";
|
||||
if (env == SPV_ENV_UNIVERSAL_1_3) {
|
||||
sstr << "OpCapability SubgroupDispatch\n";
|
||||
}
|
||||
}
|
||||
sstr << "OpMemoryModel Logical GLSL450\n";
|
||||
if (spvIsWebGPUEnv(env)) {
|
||||
sstr << "OpCapability VulkanMemoryModelKHR\n";
|
||||
sstr << "OpExtension \"SPV_KHR_vulkan_memory_model\"\n";
|
||||
sstr << "OpMemoryModel Logical VulkanKHR\n";
|
||||
} else {
|
||||
sstr << "OpMemoryModel Logical GLSL450\n";
|
||||
}
|
||||
sstr << "OpEntryPoint " << model << " %main \"main\"\n";
|
||||
if (mode.find("LocalSizeId") == 0 || mode.find("LocalSizeHintId") == 0 ||
|
||||
mode.find("SubgroupsPerWorkgroupId") == 0) {
|
||||
@ -706,6 +714,39 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
"SubgroupsPerWorkgroup 1", "SubgroupsPerWorkgroupId %int1"),
|
||||
Values(SPV_ENV_UNIVERSAL_1_3)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(ValidateModeGLComputeWebGPUWhitelistGood,
|
||||
ValidateModeExecution,
|
||||
Combine(Values(SPV_SUCCESS), Values(""),
|
||||
Values("GLCompute"), Values("LocalSize 1 1 1"),
|
||||
Values(SPV_ENV_WEBGPU_0)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ValidateModeGLComputeWebGPUWhitelistBad, ValidateModeExecution,
|
||||
Combine(Values(SPV_ERROR_INVALID_DATA),
|
||||
Values("Execution mode must be one of OriginUpperLeft, "
|
||||
"DepthReplacing, DepthGreater, DepthLess, DepthUnchanged, "
|
||||
"LocalSize, or LocalSizeHint for WebGPU environment"),
|
||||
Values("GLCompute"), Values("LocalSizeId %int1 %int1 %int1"),
|
||||
Values(SPV_ENV_WEBGPU_0)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ValidateModeFragmentWebGPUWhitelistGood, ValidateModeExecution,
|
||||
Combine(Values(SPV_SUCCESS), Values(""), Values("Fragment"),
|
||||
Values("OriginUpperLeft", "DepthReplacing", "DepthGreater",
|
||||
"DepthLess", "DepthUnchanged"),
|
||||
Values(SPV_ENV_WEBGPU_0)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ValidateModeFragmentWebGPUWhitelistBad, ValidateModeExecution,
|
||||
Combine(Values(SPV_ERROR_INVALID_DATA),
|
||||
Values("Execution mode must be one of OriginUpperLeft, "
|
||||
"DepthReplacing, DepthGreater, DepthLess, DepthUnchanged, "
|
||||
"LocalSize, or LocalSizeHint for WebGPU environment"),
|
||||
Values("Fragment"),
|
||||
Values("PixelCenterInteger", "OriginLowerLeft",
|
||||
"EarlyFragmentTests"),
|
||||
Values(SPV_ENV_WEBGPU_0)));
|
||||
|
||||
TEST_F(ValidateModeExecution, MeshNVLocalSize) {
|
||||
const std::string spirv = R"(
|
||||
OpCapability Shader
|
||||
|
Loading…
Reference in New Issue
Block a user