Token导航 LogoToken导航

Agent Skill · 前端设计

axiom-metal-migration-ref(公理金属迁移参考)

axiom-metal-migration-ref 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

axiom-metal-migration-ref 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 1,747。

总安装 4,064周安装 166GitHub Stars 873下载 1,301核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:axiom-metal-migration-ref(公理金属迁移参考)
来源仓库:https://github.com/charleswiltgen/axiom
仓库路径:skills/axiom-metal-migration-ref
安装命令:
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-metal-migration-ref
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-metal-migration-ref

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

提供从 OpenGL/DirectX 到 Metal 的完整迁移参考,涵盖 GLSL/HLSL 转 MSL 的语法对照与最佳实践。适合在转换着色器语言、查找 API 等价实现或搭建 Metal 渲染管线时使用。支持使用 Metal Shader Converter 工具链进行自动化转换,并提供类型映射和注意事项说明。

安装前应核实目标平台兼容性,并注意部分数据类型(如 double)在 MSL 中的替代方案。建议结合官方文档和实际测试验证转换结果,确保渲染效果与预期一致。

来源仓库内路径:skills/axiom-metal-migration-ref

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/charleswiltgen/axiom --skill axiom-metal-migra…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

axiom-metal-migration-ref 怎么安装?

在终端执行 npx skills add https://github.com/charleswiltgen/axiom --skill axiom-metal-migration-ref。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

axiom-metal-migration-ref 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

axiom-metal-migration-ref 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

axiom-metal-migration-ref 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

axiom-metal-migration-ref 用的人多吗?

公开数据是累计安装 4,064 次,近一周安装 166 次,下载 1,301 次,GitHub 873 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

axiom-metal-migration-ref 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
axiom-metal-migration-ref

公理金属迁移参考 · 本页

4,064873需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

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

GLSLMSLNotes
voidvoid
boolbool
intint32-bit signed
uintuint32-bit unsigned
floatfloat32-bit
doubleN/AUse float (no 64-bit float in MSL)
vec2float2
vec3float3
vec4float4
ivec2int2
ivec3int3
ivec4int4
uvec2uint2
uvec3uint3
uvec4uint4
bvec2bool2
bvec3bool3
bvec4bool4
mat2float2x2
mat3float3x3
mat4float4x4
mat2x3float2x3Columns x Rows
mat3x4float3x4
sampler2Dtexture2d<float> + samplerSeparate in MSL
sampler3Dtexture3d<float> + sampler
samplerCubetexturecube<float> + sampler
sampler2DArraytexture2d_array<float> + sampler
sampler2DShadowdepth2d<float> + sampler

Built-in Variable Mappings

GLSLMSLStage
gl_PositionReturn [[position]]Vertex
gl_PointSizeReturn [[point_size]]Vertex
gl_VertexID[[vertex_id]] parameterVertex
gl_InstanceID[[instance_id]] parameterVertex
gl_FragCoord[[position]] parameterFragment
gl_FrontFacing[[front_facing]] parameterFragment
gl_PointCoord[[point_coord]] parameterFragment
gl_FragDepthReturn [[depth(any)]]Fragment
gl_SampleID[[sample_id]] parameterFragment
gl_SamplePosition[[sample_position]] parameterFragment

Function Mappings

GLSLMSLNotes
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:

GLSLMSL Equivalent
lowp floathalf (16-bit)
mediump floathalf (16-bit)
highp floatfloat (32-bit)
lowp intshort (16-bit)
mediump intshort (16-bit)
highp intint (32-bit)

Buffer Alignment (Critical)

GLSL/C assumes:

  • vec3: 12 bytes, any alignment
  • vec4: 16 bytes

MSL requires:

  • float3: 12 bytes storage, 16-byte aligned
  • float4: 16 bytes storage, 16-byte aligned

Solution: Use simd types in Swift for CPU-GPU shared structs:

import simd

struct Uniforms {
    var modelViewProjection: simd_float4x4  // Correct alignment
    var cameraPosition: simd_float3         // 16-byte aligned
    var padding: Float = 0                   // Explicit padding if needed
}

Or use packed types in MSL (slower):

struct VertexPacked {
    packed_float3 position;  // 12 bytes, no padding
    packed_float2 texCoord;  // 8 bytes
};

Part 2: HLSL to MSL Conversion

Type Mappings

HLSLMSLNotes
floatfloat
float2float2
float3float3
float4float4
halfhalf
intint
uintuint
boolbool
float2x2float2x2
float3x3float3x3
float4x4float4x4
Texture2Dtexture2d<float>
Texture3Dtexture3d<float>
TextureCubetexturecube<float>
SamplerStatesampler
RWTexture2Dtexture2d<float, access::read_write>
RWBufferdevice float* [[buffer(n)]]
StructuredBufferconstant T* [[buffer(n)]]
RWStructuredBufferdevice T* [[buffer(n)]]

Semantic Mappings

HLSL SemanticMSL Attribute
SV_Position[[position]]
SV_Target0Return value / [[color(0)]]
SV_Target1[[color(1)]]
SV_Depth[[depth(any)]]
SV_VertexID[[vertex_id]]
SV_InstanceID[[instance_id]]
SV_IsFrontFace[[front_facing]]
SV_SampleIndex[[sample_id]]
SV_PrimitiveID[[primitive_id]]
SV_DispatchThreadID[[thread_position_in_grid]]
SV_GroupThreadID[[thread_position_in_threadgroup]]
SV_GroupID[[threadgroup_position_in_grid]]
SV_GroupIndex[[thread_index_in_threadgroup]]

Function Mappings

HLSLMSLNotes
tex.Sample(samp, uv)tex.sample(samp, uv)Lowercase
tex.SampleLevel(samp, uv, lod)tex.sample(samp, uv, level(lod))
tex.SampleGrad(samp, uv, ddx, ddy)tex.sample(samp, uv, gradient2d(ddx, ddy))
tex.Load(coord)tex.read(coord.xy, coord.z)Split coord
mul(a, b)a * bOperator
saturate(x)saturate(x)Same
lerp(a, b, t)mix(a, b, t)Different name
frac(x)fract(x)Different name
ddx(v)dfdx(v)Different name
ddy(v)dfdy(v)Different name
clip(x)if (x < 0) discard_fragment()Manual
discarddiscard_fragment()Function call

Metal Shader Converter (DirectX → Metal)

Apple's official tool for converting DXIL (compiled HLSL) to Metal libraries.

Requirements:

  • macOS 13+ with Xcode 15+
  • OR Windows 10+ with VS 2019+
  • Target devices: Argument Buffers Tier 2 (macOS 14+, iOS 17+)

Workflow:

# Step 1: Compile HLSL to DXIL using DXC
dxc -T vs_6_0 -E MainVS -Fo vertex.dxil shader.hlsl
dxc -T ps_6_0 -E MainPS -Fo fragment.dxil shader.hlsl

# Step 2: Convert DXIL to Metal library
metal-shaderconverter vertex.dxil -o vertex.metallib
metal-shaderconverter fragment.dxil -o fragment.metallib

# Step 3: Load in Swift
let vertexLib = try device.makeLibrary(URL: vertexURL)
let fragmentLib = try device.makeLibrary(URL: fragmentURL)

Key Options:

OptionPurpose
-o <file>Output metallib path
--minimum-gpu-familyTarget GPU family
--minimum-os-build-versionMinimum OS version
--vertex-stage-inSeparate vertex fetch function
-dualSourceBlendingEnable dual-source blending

Supported Shader Models: SM 6.0 - 6.6 (with limitations on 6.6 features)

Part 3: OpenGL API to Metal API

View/Context Setup

OpenGLMetal
NSOpenGLViewMTKView
GLKViewMTKView
EAGLContextMTLDevice + MTLCommandQueue
CGLContextObjMTLDevice

Resource Creation

OpenGLMetal
glGenBuffers + glBufferDatadevice.makeBuffer(bytes:length:options:)
glGenTextures + glTexImage2Ddevice.makeTexture(descriptor:) + texture.replace(region:...)
glGenFramebuffersMTLRenderPassDescriptor
glGenVertexArraysMTLVertexDescriptor
glCreateShader + glCompileShaderBuild-time compilation → MTLLibrary
glCreateProgram + glLinkProgramMTLRenderPipelineDescriptor → MTLRenderPipelineState

State Management

OpenGLMetal
glEnable(GL_DEPTH_TEST)MTLDepthStencilDescriptor → MTLDepthStencilState
glDepthFunc(GL_LESS)descriptor.depthCompareFunction =.less
glEnable(GL_BLEND)pipelineDescriptor.colorAttachments[0].isBlendingEnabled = true
glBlendFuncsourceRGBBlendFactor, destinationRGBBlendFactor
glCullFaceencoder.setCullMode(.back)
glFrontFaceencoder.setFrontFacing(.counterClockwise)
glViewportencoder.setViewport(MTLViewport(...))
glScissorencoder.setScissorRect(MTLScissorRect(...))

Draw Commands

OpenGLMetal
glDrawArrays(mode, first, count)encoder.drawPrimitives(type:vertexStart:vertexCount:)
glDrawElements(mode, count, type, indices)encoder.drawIndexedPrimitives(type:indexCount:indexType:indexBuffer:indexBufferOffset:)
glDrawArraysInstancedencoder.drawPrimitives(type:vertexStart:vertexCount:instanceCount:)
glDrawElementsInstancedencoder.drawIndexedPrimitives(...instanceCount:)

Primitive Types

OpenGLMetal
GL_POINTS.point
GL_LINES.line
GL_LINE_STRIP.lineStrip
GL_TRIANGLES.triangle
GL_TRIANGLE_STRIP.triangleStrip
GL_TRIANGLE_FANN/A (decompose to triangles)

Part 4: Complete Setup Examples

MTKView Setup (Recommended)

import MetalKit

class GameViewController: UIViewController {
    var metalView: MTKView!
    var renderer: Renderer!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Create Metal view
        guard let device = MTLCreateSystemDefaultDevice() else {
            fatalError("Metal not supported")
        }

        metalView = MTKView(frame: view.bounds, device: device)
        metalView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        metalView.colorPixelFormat = .bgra8Unorm
        metalView.depthStencilPixelFormat = .depth32Float
        metalView.clearColor = MTLClearColor(red: 0, green: 0, blue: 0, alpha: 1)
        metalView.preferredFramesPerSecond = 60
        view.addSubview(metalView)

        // Create renderer
        renderer = Renderer(metalView: metalView)
        metalView.delegate = renderer
    }
}

class Renderer: NSObject, MTKViewDelegate {
    let device: MTLDevice
    let commandQueue: MTLCommandQueue
    var pipelineState: MTLRenderPipelineState!
    var depthState: MTLDepthStencilState!
    var vertexBuffer: MTLBuffer!

    init(metalView: MTKView) {
        device = metalView.device!
        commandQueue = device.makeCommandQueue()!
        super.init()

        buildPipeline(metalView: metalView)
        buildDepthStencil()
        buildBuffers()
    }

    private func buildPipeline(metalView: MTKView) {
        let library = device.makeDefaultLibrary()!

        let descriptor = MTLRenderPipelineDescriptor()
        descriptor.vertexFunction = library.makeFunction(name: "vertexShader")
        descriptor.fragmentFunction = library.makeFunction(name: "fragmentShader")
        descriptor.colorAttachments[0].pixelFormat = metalView.colorPixelFormat
        descriptor.depthAttachmentPixelFormat = metalView.depthStencilPixelFormat

        // Vertex descriptor (matches shader's VertexIn struct)
        let vertexDescriptor = MTLVertexDescriptor()
        vertexDescriptor.attributes[0].format = .float3
        vertexDescriptor.attributes[0].offset = 0
        vertexDescriptor.attributes[0].bufferIndex = 0
        vertexDescriptor.attributes[1].format = .float2
        vertexDescriptor.attributes[1].offset = MemoryLayout<SIMD3<Float>>.stride
        vertexDescriptor.attributes[1].bufferIndex = 0
        vertexDescriptor.layouts[0].stride = MemoryLayout<Vertex>.stride
        descriptor.vertexDescriptor = vertexDescriptor

        pipelineState = try! device.makeRenderPipelineState(descriptor: descriptor)
    }

    private func buildDepthStencil() {
        let descriptor = MTLDepthStencilDescriptor()
        descriptor.depthCompareFunction = .less
        descriptor.isDepthWriteEnabled = true
        depthState = device.makeDepthStencilState(descriptor: descriptor)
    }

    func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {
        // Handle resize
    }

    func draw(in view: MTKView) {
        guard let drawable = view.currentDrawable,
              let descriptor = view.currentRenderPassDescriptor,
              let commandBuffer = commandQueue.makeCommandBuffer(),
              let encoder = commandBuffer.makeRenderCommandEncoder(descriptor: descriptor) else {
            return
        }

        encoder.setRenderPipelineState(pipelineState)
        encoder.setDepthStencilState(depthState)
        encoder.setVertexBuffer(vertexBuffer, offset: 0, index: 0)
        encoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: vertexCount)
        encoder.endEncoding()

        commandBuffer.present(drawable)
        commandBuffer.commit()
    }
}

CAMetalLayer Setup (Custom Control)

import Metal
import QuartzCore

class MetalLayerView: UIView {
    var metalLayer: CAMetalLayer!
    var device: MTLDevice!
    var commandQueue: MTLCommandQueue!
    var displayLink: CADisplayLink?

    override class var layerClass: AnyClass { CAMetalLayer.self }

    override init(frame: CGRect) {
        super.init(frame: frame)
        setup()
    }

    private func setup() {
        device = MTLCreateSystemDefaultDevice()!
        commandQueue = device.makeCommandQueue()!

        metalLayer = layer as? CAMetalLayer
        metalLayer.device = device
        metalLayer.pixelFormat = .bgra8Unorm
        metalLayer.framebufferOnly = true

        displayLink = CADisplayLink(target: self, selector: #selector(render))
        displayLink?.add(to: .main, forMode: .common)
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        metalLayer.drawableSize = CGSize(
            width: bounds.width * contentScaleFactor,
            height: bounds.height * contentScaleFactor
        )
    }

    @objc func render() {
        guard let drawable = metalLayer.nextDrawable(),
              let commandBuffer = commandQueue.makeCommandBuffer() else {
            return
        }

        let descriptor = MTLRenderPassDescriptor()
        descriptor.colorAttachments[0].texture = drawable.texture
        descriptor.colorAttachments[0].loadAction = .clear
        descriptor.colorAttachments[0].storeAction = .store
        descriptor.colorAttachments[0].clearColor = MTLClearColor(red: 0, green: 0, blue: 0, alpha: 1)

        guard let encoder = commandBuffer.makeRenderCommandEncoder(descriptor: descriptor) else {
            return
        }

        // Draw commands here
        encoder.endEncoding()

        commandBuffer.present(drawable)
        commandBuffer.commit()
    }
}

Compute Shader Setup

class ComputeProcessor {
    let device: MTLDevice
    let commandQueue: MTLCommandQueue
    var computePipeline: MTLComputePipelineState!

    init() {
        device = MTLCreateSystemDefaultDevice()!
        commandQueue = device.makeCommandQueue()!

        let library = device.makeDefaultLibrary()!
        let function = library.makeFunction(name: "computeKernel")!
        computePipeline = try! device.makeComputePipelineState(function: function)
    }

    func process(input: MTLBuffer, output: MTLBuffer, count: Int) {
        let commandBuffer = commandQueue.makeCommandBuffer()!
        let encoder = commandBuffer.makeComputeCommandEncoder()!

        encoder.setComputePipelineState(computePipeline)
        encoder.setBuffer(input, offset: 0, index: 0)
        encoder.setBuffer(output, offset: 0, index: 1)

        let threadGroupSize = MTLSize(width: 256, height: 1, depth: 1)
        let threadGroups = MTLSize(
            width: (count + 255) / 256,
            height: 1,
            depth: 1
        )

        encoder.dispatchThreadgroups(threadGroups, threadsPerThreadgroup: threadGroupSize)
        encoder.endEncoding()

        commandBuffer.commit()
        commandBuffer.waitUntilCompleted()
    }
}
// Compute shader
kernel void computeKernel(
    device float* input [[buffer(0)]],
    device float* output [[buffer(1)]],
    uint id [[thread_position_in_grid]]
) {
    output[id] = input[id] * 2.0;
}

Part 5: Storage Modes & Synchronization

Buffer Storage Modes

ModeCPU AccessGPU AccessUse Case
.sharedRead/WriteRead/WriteSmall dynamic data, uniforms
.privateNoneRead/WriteStatic assets, render targets
.managed (macOS)Read/WriteRead/WriteLarge buffers with partial updates
// Shared: CPU and GPU both access (iOS typical)
let uniformBuffer = device.makeBuffer(length: size, options: .storageModeShared)

// Private: GPU only (best for static geometry)
let vertexBuffer = device.makeBuffer(bytes: vertices, length: size, options: .storageModePrivate)

// Managed: Explicit sync (macOS)
#if os(macOS)
let buffer = device.makeBuffer(length: size, options: .storageModeManaged)
// After CPU write:
buffer.didModifyRange(0..<size)
#endif

Texture Storage Modes

let descriptor = MTLTextureDescriptor.texture2DDescriptor(
    pixelFormat: .rgba8Unorm,
    width: 1024,
    height: 1024,
    mipmapped: true
)

// For static textures (loaded once)
descriptor.storageMode = .private
descriptor.usage = [.shaderRead]

// For render targets
descriptor.storageMode = .private
descriptor.usage = [.renderTarget, .shaderRead]

// For CPU-readable (screenshots, readback)
descriptor.storageMode = .shared  // iOS
descriptor.storageMode = .managed  // macOS
descriptor.usage = [.shaderRead, .shaderWrite]

Resources

WWDC: 2016-00602, 2018-00604, 2019-00611

Docs: /metal/migrating-opengl-code-to-metal, /metal/shader-converter, /metalkit/mtkview

Skills: axiom-metal-migration, axiom-metal-migration-diag


Last Updated: 2025-12-29 Platforms: iOS 12+, macOS 10.14+, tvOS 12+ Status: Complete shader conversion and API mapping reference

平台分布

Claude Code

28.8%
按下载量换算375

Codex

25.37%
按下载量换算330

OpenCode

19.04%
按下载量换算248

Antigravity

12.7%
按下载量换算165

Cursor

7.82%
按下载量换算102

windsurf

4.08%
按下载量换算53

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills