Use high precision in generated ESSL#2792
Use high precision in generated ESSL#2792jstone-lucasfilm merged 2 commits intoAcademySoftwareFoundation:mainfrom
Conversation
|
@kwokcb I think you're right on the mark with your change from I'm less convinced by the universal raising of M_FLOAT_EPS from What are your thoughts on the earlier suggestion to provide a shader generator option for |
|
The issue with the approach is that there is no way to detect when your generating the code where it's going to be deployed to, and I'm not sure if these are the only places that can be affected. So I propose to either:
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
#define MX_FLOAT_EPS 1e-8
#else
#define MX_FLOAT_EPS 1e-4
#endif
#else
#define M_FLOAT_EPS 1e-8
#endifThis would not affect any device which guarantees I can remove the second change and see how it goes. If it's still not good, I can put up a separate PR for a better tolerance approach, or add 2. into this PR if your okay with it. How does that sound ? |
|
The latest deployment seems good with just the |
jstone-lucasfilm
left a comment
There was a problem hiding this comment.
Thanks for this improvement, @kwokcb!
72d59cb
into
AcademySoftwareFoundation:main
Change
highpto use 32-bit precision with ESSLFixes: #2655, #2654.
Details
High Precision Change
The minimum ESSL version required is 3.0 , where
highpprecision is mandatory in fragment shaders, so the switch is safe.Instead of IEEE 754 half‑precision (16‑bit) we now use single‑precision (32‑bit). This avoids cases of underflow/overflow and reduces accumulated math errors (for Std surface, OpenPBR and glTF).
Results
I have pushed locally to: https://kwokcb.github.io/MaterialX/
Specific testing for specular roughness shows that this is now working: