Files
FlaxEngine/Source/Engine/ShadersCompilation/WebGPU/ShaderCompilerWebGPU.h
Wojtek Figat 9be8589437 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
2026-02-24 17:55:26 +01:00

29 lines
1021 B
C++

// Copyright (c) Wojciech Figat. All rights reserved.
#pragma once
#if COMPILE_WITH_WEBGPU_SHADER_COMPILER
#include "Engine/ShadersCompilation/Vulkan/ShaderCompilerVulkan.h"
/// <summary>
/// Implementation of shaders compiler for Web GPU rendering backend.
/// </summary>
class ShaderCompilerWebGPU : public ShaderCompilerVulkan
{
public:
/// <summary>
/// Initializes a new instance of the <see cref="ShaderCompilerWebGPU"/> class.
/// </summary>
/// <param name="profile">The profile.</param>
ShaderCompilerWebGPU(ShaderProfile profile);
protected:
bool OnCompileBegin() override;
void InitParsing(ShaderCompilationContext* context, glslang::TShader& shader) override;
void InitCodegen(ShaderCompilationContext* context, glslang::SpvOptions& spvOptions) override;
bool Write(ShaderCompilationContext* context, ShaderFunctionMeta& meta, int32 permutationIndex, const ShaderBindings& bindings, struct SpirvShaderHeader& header, std::vector<unsigned>& spirv) override;
};
#endif