Improve Metal syntax#2622
Merged
jstone-lucasfilm merged 2 commits intoAcademySoftwareFoundation:mainfrom Oct 15, 2025
Merged
Conversation
Ideally all metal source files should be legal metal syntax.
… to allow for output types to be replaced.
jstone-lucasfilm
approved these changes
Oct 15, 2025
Member
jstone-lucasfilm
left a comment
There was a problem hiding this comment.
No objections on my side, @ld-kerley, and this looks good to me!
55e8204
into
AcademySoftwareFoundation:main
32 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current Metal shader generator is highly derived from the Glsl shader generator. We then use a function (
MetalizeGeneratedShader) to string process the GLSL source to convert it to legal Metal shader source.Currently there is still a lot of GLSL syntax left, and we rely on
#definestatements and the Metal compiler preprocessor to create correct syntax.This PR does the following:
MetalizeGeneratedShaderreplacing the preprocessor defines.mx_math.metalto be legal Metal syntax, and not rely on theMetalizeGeneratedShaderfunction.T_TEX_SAMPLER_SAMPLER2DandT_TEX_SAMPLER_SIGNATUREspecific to the required Metal syntax.Ideally all metal source files should be legal metal syntax.
This work is a pre-cursor to other work to improve Metal support, and it would be helpful to get this piece merged and tested to make that work easier moving forwards.