Run dead code elimination for WGSL even if all other optimizations are disabled

This commit is contained in:
bridgewaterrobbie
2025-03-14 17:23:10 -04:00
committed by bridgewaterrobbie
parent 49b7c7169f
commit 84cce8cfdf
2 changed files with 7 additions and 2 deletions

View File

@@ -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{};

View File

@@ -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 {