2.2 KiB
2.2 KiB
METAL version
Metal support is currently highly experimental and very work in progress.
Porting Progress
- Animation
- Blend
- Color
- Blend
- Dither (not fully vetted / just spot checked)
- Palette
- Levels
- Space
- Tonemap
- Distort
- Draw - (not fully vetted / just spot checked)
- Filters
- Gaussian Blur
- Box 2d
- Generative (not fully vetted / just spot checked)
- Geometry
- Lighting
- Math - (not fully vetted / just spot checked)
- Morphological
- Sample
- Sampler
- SDF - (not fully vetted / just spot checked)
- Space
Porting Methodology
- dupe
*.glslfiles-> and rename them to*.msl - find replace
.glsl->.msland ensure you repeat the above for imports - find replace
vec2->float2 - find replace
vec3->float3 - find replace
vec4->float4 - find replace
matN->matrix<float, n, n> - find replace
infunction argument keyword -> `` as metal doesn't have the in function keyword - find
inoutand determine which thread local memory keyword should replace it, and make it a reference - ensure
constis only used within functions,constantmust be used for global scoped constants
Things to look out for
- Metal does not have the same basic math functions signatures as GLSL. We are adding all the polyfill functions in the
math/folder. - Texture precision and filtering.
- Added
SAMPLER_TYPEwhich specifies the texture precisions. Defaults totexture2d<float> - This means your texture definition must match the default
floatprecision, or you will need to overrideSAMPLER_TYPE - Added
SAMPLERwhich specifies the Metal sampler object. Defaults tosampler( min_filter::linear, mag_filter::linear )
- Added
Things not yet done
gl_FragCoordcompatibilty. Not sure if there is a nice way to make this work without end users annotating their root Metal shader entry point.- For now, use the function definitions which pass the position coords from your main shader.
atan/atan2compatibility. Need to see if there is a nice way to override the function signatures to match.