-
Speedrun your game port with agentic coding
Kickstart your game's journey to Apple platforms with new agentic skills in Game Porting Toolkit 4 that can dramatically accelerate the process of porting your game. Explore how to work alongside your AI coding assistant to adopt Metal 4, integrate MetalFX, and tune your game for Apple hardware. Find out how agents can autonomously troubleshoot GPU rendering issues using Metal debugging tools, empowering you to focus on what matters most.
Chapters
- 0:00 - Introduction
- 1:06 - Porting assistant workflow
- 6:25 - Windowing and frame pacing
- 8:28 - Scene rendering with Metal 4
- 15:16 - Debugging with GPU command-line tools
- 19:09 - Game controllers and MetalFX
- 25:11 - Next steps
Resources
Related Videos
WWDC25
-
Search this video…
Hi, I'm David Srour, Engineer with the Metal Ecosystem Team. We're at a moment where coding agents are fundamentally changing how software gets built. Game porting is no different. What used to take months of manual platform work can now happen in a fraction of the time with the right agent workflow.
The lineup of games on Apple platforms keeps growing, and they look and play great, thanks to Apple silicon, beautiful displays, and immersive audio. Many of these games were able to come to the platform much more quickly, with the help of the Game Porting Toolkit.
And now, Game Porting Toolkit 4 brings you new agentic skills, that give your coding agent the expertise it needs to port your game to Apple platforms far faster and with better quality than ever before. Today I'll show you exactly how.
In a typical porting workflow, you've got to scope out the work, get a build going and convert your shaders, bring up the renderer, remap all your inputs, add polish for a native platform feel, and optimize for performance. This takes time. But with Game Porting Toolkit 4, agentic skills take the stage.
And can get you there a lot faster by bridging knowledge gaps in porting to the platform, improving the quality of the agent's work, and reducing the guidance it needs from you.
The toolkit includes: Expert skills that provide technical guidance. And workflow skills that provide a structured approach.
And tying it all together is the porting assistant agent. It orchestrates the porting methodology so you can focus on the decisions that matter.
Expert skills increase the odds that the agent will output optimal code.
It does this by providing platform knowledge, applying best practices, and flagging common porting anti-patterns. That means less time debugging and a solid foundation for everything that comes after.
The porting assistant ensures the relevant skills are used at the right time. During execution, all planned milestones automatically load the necessary expert skills without relying on whether the model decides to use them or not.
Validation checks each skill's anti-patterns and best practices, and compares against ground truth captures from the evaluation environment.
The agent stores what it learns across milestones, so nothing gets lost between sessions.
To show you how this works, I'm going to port Microsoft's MiniEngine, a D3D12 open-source engine, from Windows to macOS. Here's how I'll break this up. First, I'll show you the porting assistant, how it plans and executes. Then I'll dive into the expert skills, seeing them in action during the actual port. I am using Claude Code for everything today. Let's get into it.
The skills and assistant are provided as a plugin from the Game Porting Toolkit marketplace on GitHub.
You will first add the marketplace. And then install the plugin. All the skills are now installed and ready to be used.
You're now ready to work with the porting assistant. If you're unsure what to do, just ask the assistant.
It'll be able to guide you through its structured workflow.
The first step the agent asks for, is to run a discovery. Let's look at the workflow in more detail. At a high level, the porting assistant workflow goes through three stages. The discover workflow skill looks at your codebase, grabs reference captures from the evaluation environment, and asks you questions about your preferences.
Next, you and the assistant plan milestone goals, since porting a whole title is usually too big for one session.
For each milestone, the agent executes the necessary changes and you bring your expertise to guide it along the way.
Following execution comes validation — a multi-point checklist the agent uses to check the changes that were made in the session.
The validation workflow helps keep the port moving forward.
It checks that the app launches properly, runs Metal validation on API usage and shaders, confirms visual correctness with screen captures, compares against ground truth references, reviews the code against known anti-patterns from the used skills, checks for memory issues, and more. This phase is a great place to work with the agent to address last concerns or issues that come up with each milestone. So that's the porting assistant and its workflow. I went through this same process, discovery and planning for our MiniEngine project, and got a comprehensive porting plan. Goals and milestones with expert skills mapped to each. Every goal breaks down into milestones that I can start working through.
Let's go through some of the main goals. I need a window so I can start drawing content.
Then bring up the renderer with Metal 4 to get the scene on screen. Add game controller support so I can move around.
And integrate MetalFX for upscaling. Let's see how the expert skills guide the agent through each goal with domain expertise and best practices.
Right now the app builds and runs, but there's nothing on screen. I need a window to show actual content.
I tell the agent to set up the window. And it loads the skills that it'll need. For the windowing and frame pacing milestone, the agent actually needs several skills working together to create a window, drive the render loop, map D3D12's swap chain model, and get the pacing right.
The window skill provides expertise in window creation and lifecycle. Translating to Metal maps the swap chain concepts.
Presenting drawables covers frame pacing best practices. And the metal-cpp skill teaches correct Metal object lifetime patterns. These skills cover a lot of ground for this milestone. Usually the difficulty is in ensuring that all the best practices are followed rather than some. For the window itself, the skills set up Metal display link for the render loop, handle lifecycle events like focus changes and fullscreen, and configure the layer's resolution and color space optimally for games. For presentation, they provide guidance to leverage direct-to-display presentation for lower latency, manage drawable lifetimes to avoid stuttering, and keep textures resident so the GPU can properly access them.
This will help you avoid common pitfalls that can lead to broken window behavior, dropped frames, or blank output.
And here's the result from working with the porting agent. A smooth color clear animation.
The Metal HUD shows steady frame pacing and I can be sure that presentation is solid before starting rendering work. Milestone complete.
Time to bring up the renderer. I'm targeting lighting, shadows, SSAO, and tone mapping for first playable. Metal 4 takes the API to the next level with explicit memory management and a new command structure.
The skills bridge the gaps in current models, and carry porting expertise from real-world experience.
I planned three goals with the assistant. Scene rendering, which includes the depth, shadow, and color passes. A subset of the post-processing pipeline, porting SSAO for better visual quality and tone mapping to get pixels on screen.
Finally, dynamic lighting to complete the scene.
I'll demonstrate how the skills guide the agent through each goal, starting with rendering the scene. Scene rendering has three milestones: GPU resources, shader pipelines, and command encoding.
The resources skill covers GPU memory, textures, and render targets.
The shader pipeline and converter skills wire the HLSL shaders through Metal's binding model. And the synchronization skill provides the synchronization patterns between passes.
To render the scene with Metal 4, the agent needs to manage GPU resources in ways specific to the API. The skill teaches which storage modes to use, including options specific to Apple silicon's tile architecture.
In Metal 4, constants are passed through buffers. The skill provides the recommended allocation pattern for this.
And it ensures all resources are registered in a residency set for GPU access. I'll demonstrate with an example.
The skill teaches the agent to register resources in a residency set before use, much earlier in the application. This ensures every resource is accessible when the GPU needs it.
Without the skill, the agent doesn't know this step is needed and just gets something compiled. The GPU cannot read from the texture as expected, causing incorrect results.
To connect the existing shaders to Metal, the agent needs the shader pipeline and converter skills. The skill guides the agent in creating pipeline states with Metal 4's compiler.
It teaches the encoding rules for descriptor tables.
It handles the translation of D3D12 root signatures through the Metal shader converter runtime. And it provides Metal 4's argument buffer layout model. Let's look at an example. The skill teaches the agent to query argument buffer offsets from the Metal shader converter runtime. This ensures they match what the shader expects.
Without the skill, the agent copies MiniEngine's pattern of calculating offsets with index times size. But when using Metal shader converter, the layout might be different. So those offsets are wrong. No error, just incorrect rendering.
To synchronize GPU work correctly, the agent needs the synchronization skill.
Metal 4 uses fully explicit synchronization, giving you precise control over resource dependencies.
Multiple encoders within a command buffer need proper barriers between them.
D3D12 and Metal 4 use different barrier models, and the skill maps between them.
It also provides stage mapping tables since D3D12 states don't translate directly.
I'll demonstrate. The skill teaches the agent to map D3D12 states to Metal 4's producer-consumer model. The agent implements correct synchronization from the start. Without the skill, the agent resorts to broad blanket barriers at encoder boundaries.
This may work for simple cases, but can silently break as the rendering pipeline grows more complex.
I have the first GPU workload running. The agent validates the output against the evaluation environment and confirms all three geometry passes match. Can't present yet without post processing, but I know it's on the right track. Time to get pixels on screen. The post-processing pipeline introduces compute dispatches for the SSAO and tone-mapping passes.
Post processing has two parts. The SSAO chain, a series of compute dispatches that need correct resource setup and synchronization. And tone mapping, which transitions from compute back to render. The same rendering skills as before are leveraged for both.
These same skills now also act as guardrails.
The synchronization skill catches barrier configurations that don't account for how Apple silicon's tile memory works.
The resources skill provides safe defaults for resources not yet bound during incremental porting. And the shader converter skill catches data alignment mismatches between the engine and its shaders. I'll demonstrate.
The skill teaches the agent to leverage Metal shader converter's reflection to query the actual parameter count from the shader. The layout matches and everything aligns.
Without the skill, the agent carries over the engine's original 5 root parameters. But Metal shader converter determines the layout from the HLSL shader, which only declares 4. That mismatch shifts the sampler table to the wrong offset.
I got first light! This is always a rewarding milestone. But something is off. I can clearly see SSAO working on the drapes, that's encouraging. But the overall lighting is wrong and textures on the wall surfaces are visibly stretched.
Let's debug this! Normally I'd capture a frame in Xcode and diagnose the issue. But until now, an agent couldn't do that on its own. But macOS 27 introduces new command-line tools which support fully autonomous agent workflows: gpucapture for capturing a GPU frame, and gpudebug for analyzing it. Let's see how the agent leverages these new tools with the GPU debugging skill.
I first describe the visual symptoms I observed. The agent loads the debugging rendering issues skill. It provides a structured methodology to go from symptoms to root causes.
With the application running, the agent leverages the gpucapture tool to capture a GPU trace.
Now it's leveraging gpudebug tool to inspect the capture. It can examine anything you'd normally check in Xcode, resource bindings, constants, resource contents, and data flow through the pipeline. It's tracing where things diverge from the evaluation environment.
The agent identifies the problem, and implements a fix. The structured debugging approach means it didn't waste time guessing. It narrowed down to the problem systematically.
And here's the corrected build of MiniEngine after the agent's fix. The lighting and texture maps now match the expected output.
During validation, the agent uses the GPU tools again to carefully check a frame capture. The agent matches the dispatch calls and pipelines against my original trace from the evaluation environment.
It checks all details, including the dispatch dimensions.
Doing such validations manually for every milestone is usually tedious. It requires loading multiple captures and comparing a large amount of data side-by-side.
With the new tools provided in macOS 27, the agent can handle this on its own much more quickly. The final goal is dynamic lights. 128 point and spot lights, computed through a light culling pass. Most of the compute infrastructure is already working, but there are new challenges with mixed resource types and new synchronization patterns.
Dynamic lights need a compute-based light culling pass that mixes buffers and textures, along with new GPU resources for the light data. The shader converter and synchronization skills handle the culling pass while the resources skill covers the light data.
Even with the compute infrastructure in place, the skills flag issues specific to this milestone.
The residency pattern from earlier pays off once again and new light resources are made GPU-accessible automatically.
The sync skill catches invalid render stage flags the agent set on compute encoders. And the shader converter skill ensures correct binding for mixed resource types.
And there's our first playable. The Sponza scene is properly lit with directional and dynamic lighting. The app uses all the rendering features that were ported using Metal 4.
That's first playable done. Let's keep going and add some more features to MiniEngine.
Keyboard and mouse have been fine so far, but let's add gamepad support for better camera control.
I prompt the agent to add controller support, and it loads the game controller skill.
The controller skill covers GCController discovery, the input model, and porting from Windows APIs. On Windows, XInput provides a fixed controller layout. The skill teaches the agent to check what each controller actually supports instead.
Same idea for inputs. Rather than hardcoding a button map, the skill has the agent query what's actually available on the connected device.
And controllers can show up or disappear at any time. The skill provides the right discovery and disconnect patterns so the agent handles that gracefully.
Gamepad is working.
Device discovery, thumbstick mapping, connect/disconnect events, everything is properly handled. This makes navigating the scene a lot smoother.
Let's push further by integrating MetalFX features. I will be adding two distinct features of MetalFX.
Upscaling renders at a lower resolution and reconstructs a higher quality image. Done right, it can match or exceed native quality.
Frame interpolation doubles the effective frame rate by generating every other frame, at the cost of some input latency. Both are about getting more out of less.
To learn more, check out "Go further with Metal 4 games." I ask the agent to add upscaling and frame interpolation. And it loads both expert MetalFX skills.
MetalFX has two milestones: temporal upscaling and frame interpolation. Each milestone leverages a separate skill that targets that feature. The upscaling skill guides the first. The frame interpolation skill handles the second. The upscaling skill handles a lot of the tricky integration work. It configures jitter correctly in pixel space. Without it, the agent would likely use normalized values that effectively disable temporal accumulation.
It sets up motion vectors with the right scale and conventions, avoiding the ghosting you'd get from a naive setup.
It provides a good starting MIP bias for the scale factor, giving you a solid base to tune from. And it provides the history reprojection setup so the scaler can accumulate detail across frames.
The frame interpolation skill handles the full integration. It sets up a dedicated present thread to keep presentation separate from rendering. Without it, the agent might present from the render thread, leading to uneven frame spacing.
It configures precise timing so interpolated and rendered frames are evenly spaced.
And it gets the presentation order right so the interpolated frames are properly interleaved with the synthesized ones.
Here's both features running together, upscaling plus frame interpolation.
The Metal HUD shows that the temporal upscaler and the interpolator are both in use.
macOS 27 extends the Metal HUD features to help debug and validate the integration. Using the Metal HUD, you can now ensure that your MetalFX integration is behaving as expected.
The upscaler's exposure parameter is displayed so you can ensure it is properly fed to the API.
You can also look at jitter sequence information to ensure they are properly set up. Out of range jitters are marked in red and a scatter plot helps you visualize their positions.
Now, let's look at the overrides options. These will help you debug your integration to get a better sense of what might be going wrong.
You're now able to visualize the exposure of your scene as observed by MetalFX. The jitter plot option will display the scatter plot in the HUD.
Both the jitter multipliers and motion vector scales can be overridden. These overrides take effect while the application is running, helping you tweak jitter multipliers or motion vector scales to debug upscaling issues.
Looking at an incorrect integration, I can observe wobbling artifacts while the camera is in motion. When looking at the motion vectors information in the HUD, I see that the X-scale axis is negated. Let's make it positive in the overrides panel.
And the motion wobbles are now fixed.
Now in the rendered output, some blurriness appears on the textured objects.
I'll tune the jitter multipliers to improve visual quality.
Here is a side by side comparison before and after tuning the jitter multipliers.
If the HUD overrides fix the output, that tells you where the bug is. You trace it back to the logic that calculates your jitter or motion vector values and fix the source.
To recap, the new agentic skills in Game Porting Toolkit 4 accelerate bringing your game to Apple platforms.
The porting assistant provides a structured approach to using both expert and workflow skills. The skills combine knowledge and best practices to get the features in your game up and running.
The assistant also helps create comprehensive porting plans with clear milestones.
I demonstrated the skills by porting Microsoft's MiniEngine as a native Mac app.
Now it uses Metal 4 to render the same features as the original application.
I also showed how the new gpudebug tool enables the agent to analyze frame traces.
And the skills help out with a variety of porting tasks, ranging from windowing, game controllers, to MetalFX. I was able to use the skills and workflows in the Game Porting Toolkit 4 to port, troubleshoot, and tune the MiniEngine from PC to Mac in a fraction of the time it would have taken to do this work manually. I let the skills do the heavy lifting, while I focused on other things: making the architectural decisions, reviewing the agent's output, and providing important context about the game. The skills handled all the platform knowledge. Before I wrap up, I'll demonstrate the porting agent's work on one last codebase. I pointed the porting assistant at Godot, a production engine with an existing Metal 3 backend, and asked it to add Metal 4 alongside it. Following the same workflow, using the same skills, and validating against ground truths and best practices. It's still a collaborative effort, but the skills sped things up significantly. It was up and running in a few days. This demonstrates that the skills scale beyond small engines to production-grade projects. To get started, download and install the skills. Try them out on your game's code base. Invoke the porting assistant, and let it guide you through the porting process. You can find the skills at the Game Porting Toolkit GitHub repository.
I can't wait to see how these skills help you bring amazing games to the Apple ecosystem. Thank you for watching.
-
-
3:31 - Install Game Porting Toolkit skills
/plugin marketplace add apple/game-porting-toolkit /plugin install game-porting-skills@game-porting-toolkit -
10:24 - Register resources for residency
// With skill residencySet->addAllocation(texture); residencySet->commit(); // ... argumentTable->setAddress(texture->gpuAddress(), bindPoint); // Without skill argumentTable->setAddress(texture->gpuAddress(), bindPoint); -
11:25 - Query argument buffer offsets
// With skill IRRootSignatureGetResourceLocations(m_MtlCurIRRootSig, locations); size_t offset = locations[i].topLevelOffset; // Without skill size_t offset = paramIndex * descriptorSize; -
12:34 - Map D3D12 states to Metal 4 stages
// With skill m_MtlPendingProducerStages |= MtlProducerStageFromD3D12(OldState); m_MtlPendingConsumerStages |= MtlConsumerStageFromD3D12(NewState); // ... m_ComputeEncoder->barrierAfterStages( m_MtlPendingProducerStages, m_MtlPendingConsumerStages, MTL4::VisibilityOptionDevice); // Without skill m_ComputeEncoder->barrierAfterStages( MTL::StageDispatch, MTL::StageAll, MTL4::VisibilityOptionDevice); -
14:24 - Query shader reflection parameter count
// With skill IRShaderReflection* refl = IRShaderReflectionCreate(); IRObjectGetReflection(compiledObj, IRShaderStageCompute, refl); // ... s_RootSignature.Reset(4, 2); // Reflection reveals: 4 params // Without skill s_RootSignature.Reset(5, 2);
-
-
- 0:00 - Introduction
An overview of how Game Porting Toolkit 4 introduces agentic skills — expert skills and workflow skills — that give a coding agent the domain knowledge to accelerate porting a game to Apple platforms.
- 1:06 - Porting assistant workflow
How the porting assistant orchestrates the full porting process across three stages: Discover (scanning the codebase and capturing reference frames from the evaluation environment), Plan (defining milestone goals collaboratively), and Execute-and-Validate (running the agent with structured validation checklists that check app launch, Metal API correctness, screen captures, anti-pattern review, and memory issues).
- 6:25 - Windowing and frame pacing
How the window, Metal swap chain, presenting drawables, and metal-cpp expert skills guide the agent to implement a correct render loop using Metal Display Link, handle lifecycle events, configure the layer for games, leverage direct-to-display presentation for lower latency, and manage drawable lifetimes to avoid stuttering.
- 8:28 - Scene rendering with Metal 4
How the GPU resources, shader pipeline, Metal Shader Converter, and synchronization expert skills guide the agent through three milestones: GPU resource management (storage modes, residency sets, constant buffer allocation), shader pipeline setup (argument buffer offsets, descriptor table encoding, root signature translation), and command encoding with Metal 4's explicit barrier model mapping D3D12 states to producer-consumer synchronization.
- 15:16 - Debugging with GPU command-line tools
How the new gpucapture and gpudebug command-line tools on macOS 27 enable fully autonomous agent-driven GPU debugging. The agent captures a frame trace, inspects pipeline state, textures, and dispatch dimensions — all without requiring manual Xcode interaction — allowing it to identify and fix rendering issues autonomously.
- 19:09 - Game controllers and MetalFX
How the game controller expert skill ports from Windows XInput to GCController with correct discovery, dynamic button layout querying, and connect/disconnect handling. Then how the MetalFX upscaling and frame interpolation skills handle jitter configuration, motion vector conventions, mip bias, history reprojection, and the dedicated present thread — with new Metal HUD debugging overlays in macOS 27 to validate and tune the integration.
- 25:11 - Next steps
How to get started: download and install the Game Porting Toolkit 4 skills from the GitHub repository, invoke the porting assistant on your codebase, and let it guide you through a structured porting plan with clear milestones.