axiom-metal-migration-ref
Use when converting shaders or looking up API equivalents - GLSL to MSL, HLSL to MSL, GL/DirectX to Metal mappings, MTKView setup code
от ComeOnOliver★ 67 звёзд на GitHub
Установить axiom-metal-migration-ref в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Metal Migration Reference
Complete reference for converting OpenGL/DirectX code to Metal.
When to Use This Reference
Use this reference when:
- Converting GLSL shaders to Metal Shading Language (MSL)
- Converting HLSL shaders to MSL
- Looking up GL/D3D API equivalents in Metal
- Setting up MTKView or CAMetalLayer
- Building render pipelines
- Using Metal Shader Converter for DirectX
Part 1: GLSL to MSL Conversion
Type Mappings
| GLSL | MSL | Notes |
|---|---|---|
void |
void |
|
bool |
bool |
|
int |
int |
32-bit signed |
uint |
uint |
32-bit unsigned |
float |
float |
32-bit |
double |
N/A | Use float (no 64-bit float in MSL) |
vec2 |
float2 |
|
vec3 |
float3 |
|
vec4 |
float4 |
|
ivec2 |
int2 |
|
ivec3 |
int3 |
|
ivec4 |
int4 |
|
uvec2 |
uint2 |
|
uvec3 |
uint3 |
|
uvec4 |
uint4 |
|
bvec2 |
bool2 |
|
bvec3 |
bool3 |
|
bvec4 |
bool4 |
|
mat2 |
float2x2 |
|
mat3 |
float3x3 |
|
mat4 |
float4x4 |
|
mat2x3 |
float2x3 |
Columns x Rows |
mat3x4 |
float3x4 |
|
sampler2D |
texture2d<float> + sampler |
Separate in MSL |
sampler3D |
texture3d<float> + sampler |
|
samplerCube |
texturecube<float> + sampler |
|
sampler2DArray |
texture2d_array<float> + sampler |
|
sampler2DShadow |
depth2d<float> + sampler |
Built-in Variable Mappings
| GLSL | MSL | Stage |
|---|---|---|
gl_Position |
Return position |
Vertex |
gl_PointSize |
Return point_size |
Vertex |
gl_VertexID |
vertex_id parameter |
Vertex |
gl_InstanceID |
instance_id parameter |
Vertex |
gl_FragCoord |
position parameter |
Fragment |
gl_FrontFacing |
front_facing parameter |
Fragment |
gl_PointCoord |
point_coord parameter |
Fragment |
gl_FragDepth |
Return depth(any) |
Fragment |
gl_SampleID |
sample_id parameter |
Fragment |
gl_SamplePosition |
sample_position parameter |
Fragment |
Function Mappings
| GLSL | MSL | Notes |
|---|---|---|
texture(sampler, uv) |
tex.sample(sampler, uv) |
Method on texture |
textureLod(sampler, uv, lod) |
tex.sample(sampler, uv, level(lod)) |
|
textureGrad(sampler, uv, ddx, ddy) |
tex.sample(sampler, uv, gradient2d(ddx, ddy)) |
|
texelFetch(sampler, coord, lod) |
tex.read(coord, lod) |
Integer coords |
textureSize(sampler, lod) |
tex.get_width(lod), tex.get_height(lod) |
Separate calls |
dFdx(v) |
dfdx(v) |
|
dFdy(v) |
dfdy(v) |
|
fwidth(v) |
fwidth(v) |
Same |
mix(a, b, t) |
mix(a, b, t) |
Same |
clamp(v, lo, hi) |
clamp(v, lo, hi) |
Same |
smoothstep(e0, e1, x) |
smoothstep(e0, e1, x) |
Same |
step(edge, x) |
step(edge, x) |
Same |
mod(x, y) |
fmod(x, y) |
Different name |
fract(x) |
fract(x) |
Same |
inversesqrt(x) |
rsqrt(x) |
Different name |
atan(y, x) |
atan2(y, x) |
Different name |
Shader Structure Conversion
GLSL Vertex Shader:
#version 300 es
precision highp float;
layout(location = 0) in vec3 aPosition;
layout(location = 1) in vec2 aTexCoord;
uniform mat4 uModelViewProjection;
out vec2 vTexCoord;
void main() {
gl_Position = uModelViewProjection * vec4(aPosition, 1.0);
vTexCoord = aTexCoord;
}
MSL Vertex Shader:
#include <metal_stdlib>
using namespace metal;
struct VertexIn {
float3 position attribute(0);
float2 texCoord attribute(1);
};
struct VertexOut {
float4 position position;
float2 texCoord;
};
struct Uniforms {
float4x4 modelViewProjection;
};
vertex VertexOut vertexShader(
VertexIn in stage_in,
constant Uniforms& uniforms buffer(1)
) {
VertexOut out;
out.position = uniforms.modelViewProjection * float4(in.position, 1.0);
out.texCoord = in.texCoord;
return out;
}
GLSL Fragment Shader:
#version 300 es
precision highp float;
in vec2 vTexCoord;
uniform sampler2D uTexture;
out vec4 fragColor;
void main() {
fragColor = texture(uTexture, vTexCoord);
}
MSL Fragment Shader:
fragment float4 fragmentShader(
VertexOut in stage_in,
texture2d<float> tex texture(0),
sampler samp sampler(0)
) {
return tex.sample(samp, in.texCoord);
}
Precision Qualifiers
GLSL precision qualifiers have no direct MSL equivalent — MSL uses explicit types:
| GLSL | MSL Equivalent |
|---|---|
lowp float |
half (16-bit) |
mediump float |
half (16-bit) |
highp float |
float (32-bit) |
lowp int |
short (16-bit) |
mediump int |
short (16-bit) |
highp int |
int (32-bit) |
Buffer Alignment (Critical)
GLSL/C assumes:
vec3: 12 bytes, any alignmentvec4: 16 bytes
MSL requires:
float3: 12 bytes storage, 16-byte alignedfloat4: 16 bytes storage, 16-by
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл axiom-metal-migration-ref?
Use when converting shaders or looking up API equivalents - GLSL to MSL, HLSL to MSL, GL/DirectX to Metal mappings, MTKView setup code
Как установить скилл axiom-metal-migration-ref?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-metal-migration-ref запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…