MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Render Tests : GLSL vs MSL Review

Open kwokcb opened this issue 3 months ago • 8 comments

Tests to Review

These are the results of GLSL vs MSL both running on Mac. Tests are filtered for RMS difference of 0.003

Image

kwokcb avatar Nov 26 '25 04:11 kwokcb

Image Image

The image addressing modes also hav unexpected "shading" for vclamp, and umirror. There are no bxdf nodes in this test. The other modes do not show this.

kwokcb avatar Nov 27 '25 14:11 kwokcb

Leaving a ping with @dleex and @lkerley as a heads up. I'd like to propose that the Metal results be used as the "reference" for hardware rasterizers but need input as for the diffs here and other outstanding diffs logged. Thanks.

IMO, address modes should be inside the shader. It's ugly that it's relying on API settings as it seems Metal does not support "clamp to border color".

kwokcb avatar Nov 27 '25 14:11 kwokcb

Metal does have a clamp to border color mode - but you can not specify arbitrary colors, just black, white or transparent - I think.

I agree as we find we need to be more portable across more platforms and languages it's probably best if we control of our own destiny and explicitly implement these features in the shader code we control.

ld-kerley avatar Dec 01 '25 18:12 ld-kerley

Thanks for looking into these diffs. I saw that the color clamp sets no mode at all. Maybe someone could take a look. Frankly, some of these modes are super old and have a hard time matching to OSL as well, so might be worth consider dropping them.

kwokcb avatar Dec 02 '25 15:12 kwokcb

For lighting setup inconsistencies it would be good to make this simpler. It's pretty onerous currently.

kwokcb avatar Dec 02 '25 15:12 kwokcb

In what sense are you seeing lighting setup inconsistencies? between GLSL and MSL? or other render targets?

ld-kerley avatar Dec 02 '25 20:12 ld-kerley

Image

This was showing up as completely the incorrect shader being rendered sometimes in CI. I ran this locally and I'm getting this really weird result running locally. I have no idea what might be causing this -- seems to be rendering one on top of another ?. This is with SHA: f296eaa01c5034ab67d75985fc397adc6582364d.

My only wild guess is some state is being left behind / not re-initialized ?

kwokcb avatar Dec 10 '25 04:12 kwokcb

I feel like I might have seen this locally the other day - and just chalked it up to a gremlin - but I'll keep an eye out - interestingly it was with this exactly same test too - I wonder if some hash somewhere (shader cache?) accidentally matches.

ld-kerley avatar Dec 10 '25 05:12 ld-kerley