Add shader compiler for WebGPU

Use existing Vulkan compiler to generate SPIR-V and convert it into WGSL with tint compiler
https://github.com/google/dawn/releases/tag/v20260219.200501
This commit is contained in:
Wojtek Figat
2026-02-24 17:55:26 +01:00
parent 9158e1c270
commit 9be8589437
17 changed files with 337 additions and 50 deletions

View File

@@ -42,6 +42,9 @@
#if COMPILE_WITH_VK_SHADER_COMPILER
#include "Vulkan/ShaderCompilerVulkan.h"
#endif
#if COMPILE_WITH_WEBGPU_SHADER_COMPILER
#include "WebGPU/ShaderCompilerWebGPU.h"
#endif
#if COMPILE_WITH_PS4_SHADER_COMPILER
#include "Platforms/PS4/Engine/ShaderCompilerPS4/ShaderCompilerPS4.h"
#endif
@@ -159,7 +162,7 @@ bool ShadersCompilation::Compile(ShaderCompilationOptions& options)
return true;
}
const int32 shadersCount = meta.GetShadersCount();
if (shadersCount == 0)
if (shadersCount == 0 && featureLevel > FeatureLevel::ES2)
{
LOG(Warning, "Shader has no valid functions.");
}
@@ -255,6 +258,11 @@ ShaderCompiler* ShadersCompilation::RequestCompiler(ShaderProfile profile, Platf
compiler = New<ShaderCompilerVulkan>(profile);
break;
#endif
#if COMPILE_WITH_WEBGPU_SHADER_COMPILER
case ShaderProfile::WebGPU:
compiler = New<ShaderCompilerWebGPU>(profile);
break;
#endif
#if COMPILE_WITH_PS4_SHADER_COMPILER
case ShaderProfile::PS4:
compiler = New<ShaderCompilerPS4>();