Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 Graphics & GamesDeveloper Tools

WWDC21 · 40 min · Graphics & Games / Developer Tools

Discover Metal debugging, profiling, and asset creation tools

Explore how Xcode can help you take your Metal debugging, profiling and asset creation workflows to the next level. Discover the latest tools for ray tracing and GPU profiling, and learn about Metal Debugger workflows. We’ll also show you how to use the Texture Converter tool, which supports all modern GPU texture formats and can easily integrate into your multi-platform asset creation pipelines.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 4 snippets

RGBM Encoding Pseudocode swift · at 27:51 ↗
float4 EncodeRGBM(float3 in)
{ 
    float4 rgbm; 
    rgbm.a = max3(in.r, in.g, in.b) / RGBM_Range;
    rgbm.rgb = in / (rgbm.a * RGBM_Range);
    return rgbm;
}
RGBM Decoding Pseudocode swift · at 28:41 ↗
float3 DecodeRGBM(float4 sample)
{ 
    const float RGBM_Range = 6.0f;
    float scale = sample.a * RGBM_Range;
    return sample.rgb * scale;
}
MetalTextureSwizzles objectivec · at 30:55 ↗
// Remap the X and Y channels to red and green channels for normal maps 
compressed with ASTC.
 
MTLTextureDescriptor* descriptor = [[MTLTextureDescriptor alloc] init];

MTLTextureSwizzle r = MTLTextureSwizzleRed;
MTLTextureSwizzle g = MTLTextureSwizzleAlpha;
MTLTextureSwizzle b = MTLTextureSwizzleZero;
MTLTextureSwizzle a = MTLTextureSwizzleZero;

descriptor.swizzle = MTLTextureSwizzleChannelsMake( r, g, b, a );
ReconstructNormal objectivec · at 31:55 ↗
// Reconstruct z-axis from normal sample in shader code.

float3 ReconstructNormal(float2 sample)
{
    float3 normal;

    normal.xy = sample.xy * 2.0f - 1.0f;
    normal.z  = sqrt( saturate( 1.0f - dot( normal.xy, normal.xy ) ) );

    return normal;
}

Resources