Skip to content

Commit

Permalink
Don't drop unused vertex attributes (fixes #68)
Browse files Browse the repository at this point in the history
Replaces the SPIRVTools optimizer call to CreateAggressiveDCEPass()
with its variant which preserves shader IO items.
  • Loading branch information
floooh committed Apr 3, 2022
1 parent 54201d1 commit 16492a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/shdc/spirv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ static void spirv_optimize(slang_t::type_t slang, std::vector<uint32_t>& spirv)
optimizer.RegisterPass(spvtools::CreateLocalSingleBlockLoadStoreElimPass());
optimizer.RegisterPass(spvtools::CreateLocalSingleStoreElimPass());
optimizer.RegisterPass(spvtools::CreateSimplificationPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(true)); // NOTE: call the "preserveInterface" version of CreateAggressiveDCEPass()
optimizer.RegisterPass(spvtools::CreateVectorDCEPass());
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(true));
optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass());
// NOTE: it's the BlockMergePass which moves the init statement of a for-loop
// out of the for-statement, which makes it invalid for WebGL
Expand All @@ -142,11 +142,11 @@ static void spirv_optimize(slang_t::type_t slang, std::vector<uint32_t>& spirv)
// optimizer.RegisterPass(spvtools::CreateLocalMultiStoreElimPass());
optimizer.RegisterPass(spvtools::CreateIfConversionPass());
optimizer.RegisterPass(spvtools::CreateSimplificationPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(true));
optimizer.RegisterPass(spvtools::CreateVectorDCEPass());
optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass());
optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass());
optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass(true));
optimizer.RegisterPass(spvtools::CreateCFGCleanupPass());

spvtools::OptimizerOptions spvOptOptions;
Expand Down

0 comments on commit 16492a0

Please sign in to comment.