matc and MaterialBuilder workaround options NONE by default

The workaround option is now set to none by default. Use

```
matc -Wall
```

if you want to restore the previous behavior.

Current material workarounds:
- remove MergeReturnPass (except on Metal)
- remove SimplificationPass (except on Metal)

There are reason to believe these workarounds are no longer needed,
due to changes in spirv-opt.

It's possible that older devices might still need them.

These workaround affect *all* devices, this is why it is important
to disable them if not needed.
This commit is contained in:
Mathias Agopian
2025-09-07 23:52:14 -07:00
committed by Mathias Agopian
parent 81a51ae7e7
commit c4f083cfba
5 changed files with 20 additions and 4 deletions
+16 -1
View File
@@ -1051,7 +1051,6 @@ void GLSLPostProcessor::fixupClipDistance(
void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer, Config const& config) {
auto RegisterPass = [&](Optimizer::PassToken&& pass,
MaterialBuilder::TargetApi apiFilter = MaterialBuilder::TargetApi::ALL) {
// Workaround management is currently very simple, only two values are possible
// ALL and NONE. If the value is anything but NONE, we apply all workarounds.
if (config.workarounds != MaterialBuilderBase::Workarounds::NONE) {
@@ -1060,6 +1059,22 @@ void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer, Config c
}
}
// FIXME: Workaround within a workaround!!! We IGNORE config.workarounds for WEBGPU
// because Tint doesn't even compile with MergeReturn/Simplification pass
// active:
// Tint Reader Error: warning: code is unreachable
// error: no matching overload for 'operator << (i32, i32)'
// 2 candidate operators:
// • 'operator << (T ✓ , u32 ✗ ) -> T' where:
// ✓ 'T' is 'abstract-int', 'i32' or 'u32'
// • 'operator << (vecN<T> ✗ , vecN<u32> ✗ ) -> vecN<T>' where:
// ✗ 'T' is 'abstract-int', 'i32' or 'u32'
if (any(config.targetApi & MaterialBuilder::TargetApi::WEBGPU)) {
if (!(config.targetApi & apiFilter)) {
return;
}
}
optimizer.RegisterPass(std::move(pass));
};