Skip to content

Improve Metal syntax#2622

Merged
jstone-lucasfilm merged 2 commits intoAcademySoftwareFoundation:mainfrom
ld-kerley:msl/fix-msl-syntax
Oct 15, 2025
Merged

Improve Metal syntax#2622
jstone-lucasfilm merged 2 commits intoAcademySoftwareFoundation:mainfrom
ld-kerley:msl/fix-msl-syntax

Conversation

@ld-kerley
Copy link
Copy Markdown
Contributor

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 #define statements and the Metal compiler preprocessor to create correct syntax.

This PR does the following:

  • Adds more string processing to MetalizeGeneratedShader replacing the preprocessor defines.
  • Correct some incorrect Syntax registrations, that were still emitting Glsl types.
  • Fix mx_math.metal to be legal Metal syntax, and not rely on the MetalizeGeneratedShader function.
  • Register token substitutions for T_TEX_SAMPLER_SAMPLER2D and T_TEX_SAMPLER_SIGNATURE specific 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.

Ideally all metal source files should be legal metal syntax.
Copy link
Copy Markdown
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections on my side, @ld-kerley, and this looks good to me!

@jstone-lucasfilm jstone-lucasfilm merged commit 55e8204 into AcademySoftwareFoundation:main Oct 15, 2025
32 checks passed
@ld-kerley ld-kerley deleted the msl/fix-msl-syntax branch November 21, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants