diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp index 794425ee00..75e819bca6 100644 --- a/libs/filamat/src/GLSLPostProcessor.cpp +++ b/libs/filamat/src/GLSLPostProcessor.cpp @@ -518,8 +518,13 @@ void GLSLPostProcessor::spirvToMsl(const SpirvBlob* spirv, std::string* outMsl, } } -bool GLSLPostProcessor::spirvToWgsl(const SpirvBlob *spirv, std::string *outWsl) { +bool GLSLPostProcessor::spirvToWgsl(SpirvBlob *spirv, std::string *outWsl) { #if FILAMENT_SUPPORTS_WEBGPU + // We need to remove dead code for our variant-filter workaround for WebGPU to work + // This is especially relevant for removing the push constants that morphing uses when not disabled + spv::spirvbin_t remapper(0); + remapper.remap(*spirv, spv::spirvbin_base_t::DCE_ALL); + //Currently no options we want to use const tint::spirv::reader::Options readerOpts{}; tint::wgsl::writer::Options writerOpts{}; diff --git a/libs/filamat/src/GLSLPostProcessor.h b/libs/filamat/src/GLSLPostProcessor.h index e7a6363e82..352083f45f 100644 --- a/libs/filamat/src/GLSLPostProcessor.h +++ b/libs/filamat/src/GLSLPostProcessor.h @@ -90,7 +90,7 @@ public: bool useFramebufferFetch, const DescriptorSets& descriptorSets, const ShaderMinifier* minifier); - static bool spirvToWgsl(const SpirvBlob* spirv, std::string* outWsl); + static bool spirvToWgsl(SpirvBlob* spirv, std::string* outWsl); private: struct InternalConfig {