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
+1
View File
@@ -12,3 +12,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
available on Metal). Non-Metal backends can use the callback to be notified when Filament has
finished processing a frame on the CPU.
- materials: added `getEyeFromViewMatrix()` for vertex shader [⚠️ **Recompile Materials**]
- matc: make `--workarounds=none` the default [**Recompile Materials to take effect**]
@@ -146,7 +146,7 @@ protected:
Platform mPlatform = Platform::DESKTOP;
TargetApi mTargetApi = (TargetApi) 0;
Optimization mOptimization = Optimization::PERFORMANCE;
Workarounds mWorkarounds = Workarounds::ALL;
Workarounds mWorkarounds = Workarounds::NONE;
bool mPrintShaders = false;
bool mSaveRawVariants = false;
bool mGenerateDebugInfo = false;
+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));
};
@@ -171,7 +171,7 @@ protected:
StringReplacementMap mTemplateMap;
StringReplacementMap mMaterialParameters;
filament::UserVariantFilterMask mVariantFilter = 0;
Workarounds mWorkarounds = Workarounds::ALL;
Workarounds mWorkarounds = Workarounds::NONE;
bool mIncludeEssl1 = true;
};
+1 -1
View File
@@ -146,7 +146,7 @@ static void usage(char* name) {
" ssr (screen-space reflections), stereo\n"
" This variant filter is merged with the filter from the material, if any\n\n"
" --workarounds, -W\n"
" Workarounds to apply: all or none. (default is all).\n\n"
" Workarounds to apply: all or none. (default is none).\n\n"
" --version, -v\n"
" Print the material version number\n\n"
"Internal use and debugging only:\n"