Streaming is available in most browsers,
and in the Developer app.
-
Bring your game to Mac, Part 1: Make a game plan
Bring modern, high-end games to Mac and iPad with the powerful features of Metal and Apple silicon. Discover the game porting toolkit and learn how it can help you evaluate your existing Windows game for graphics feature compatibility and performance. We'll share best practices and technical resources for handling audio, input, and advanced display features. Once you've watched this session, check out “Bring your game to Mac, Part 2: Compile your shaders” to learn more about bringing HLSL shaders to Metal.
Chapters
- 0:00 - Intro
- 0:57 - Game porting toolkit
- 3:04 - Evaluate your game
- 8:46 - Compile your shaders
- 9:13 - Render with Metal
- 9:44 - Input
- 11:12 - Audio
- 13:08 - Display
- 14:37 - Wrap-Up
Resources
- Achieving smooth frame rates with Metal’s display link
- Download the game porting toolkit
- Download the Metal shader converter (Mac and Windows)
- Game Controller
Related Videos
WWDC23
- Bring your game to Mac, Part 2: Compile your shaders
- Bring your game to Mac, Part 3: Render with Metal
Tech Talks
WWDC22
WWDC21
- Discover geometry-aware audio with the Physical Audio Spatialization Engine (PHASE)
- Explore HDR rendering with EDR
- Tap into virtual and physical game controllers
WWDC20
-
Download
♪ ♪ Aiswariya: Hello and welcome. My name is Aiswariya, and I'm very excited to talk to you about bringing your game to the Mac. This session is the first in a three-part series about how to bring your high-end game to Mac. In the second and third sessions, my colleagues will focus on tools and techniques for compiling your shaders and best practices when rendering natively with Metal. You have everything you need to deliver an amazing gaming experience with Apple Silicon Mac’s advanced graphics, fantastic performance, immersive audio, stunning displays, and feature-rich software. With Macs more popular than ever before, there’s never been a better time to bring your games to millions of new players. Porting your Windows game to the Mac is now faster than ever. This year, the new Game Porting Toolkit provides an emulation environment to run your existing, unmodified Windows game, and you can use it to quickly understand the graphics feature usage and performance potential of your game when running on a Mac. It doesn't take months to get a sense of how your game looks, sounds, and plays. You see your game’s potential right away.
Porting your Windows game to a whole new platform typically involves many steps before you even see your first scene running, including recompiling your source code; converting thousands of custom shaders from HLSL; re-implementing your graphics subsystem; and converting your use of audio, input, display, and HDR rendering– all before you can even see your first scene running natively– and then finally debugging and optimizing for performance before you release it. With the help of the Game Porting Toolkit, you can now see your game's first scene running on the platform much earlier. The Game Porting Toolkit includes a new Metal Shader Converter, which you can use to automatically convert all of your existing HLSL GPU shaders to Metal. With the Metal Shader Converter, bringing your shaders and graphics to Mac takes a lot less time too. You can ship sooner and still have more time to take advantage of the unique features of Mac and Apple silicon. Seeing your game running right away can even help you when you use a cross-platform engine to take care of most of your porting. You can see your game's potential ahead of porting any platform-specific code or plug-ins that your Windows game added over the cross-platform engine. Porting your game to the Mac starts with evaluating your game, followed by compiling your shaders, rendering with Metal, converting your game’s use of input, audio, and display and HDR rendering. The first step is to use the Game Porting Toolkit to evaluate your game. The environment of the Game Porting Toolkit translates your game’s Intel instructions and its use of Windows APIs for keyboard, mouse, and controller input; for audio playback; for networking and file system use; and of course, for graphics. All modern graphics features, such as GPU-driven pipelines and SIMD operations, and even older features, such as tessellation and geometry shaders, are translated. Take a look at this in action. Here’s how a developer like Bloober might use the Game Porting Toolkit to examine their Windows DirectX 12 build of "The Medium." "The Medium" is a recent game developed and published by Bloober. Their native Apple Silicon and Metal release is an amazing, beautiful, super fun game to play. It’s also just a little bit scary, delivering a highly immersive graphics and audio experience for the player. After installing the tool kit, they copy a Windows build of "The Medium" to their Mac and launch it from a terminal. As it launches in the Game Porting Toolkit’s translation environment, logging and debug information appears in the terminal. When you launch your game, this logging may include potential issues for you to address, but things look clear here for Bloober’s developers. Take a look in the Game Porting Toolkit documentation to find details on what you might find in the logging for your game. Here the developer sees that the gaming is running well with all of its graphics features enabled, and it's working as expected. They’ll notice that features like transparency, reflection, geometry shaders, tessellation, and their unique and moody global illumination approach to lighting have all been translated into Metal 3 and look crisp and pixel-perfect. The next step is to play for a little bit to get a sense of baseline performance. It’s worth noting that the baseline performance you will observe running your Windows game includes all the overhead of the Game Porting Toolkit as well as API and instruction set translation.
In Bloober’s case, the Windows version is of course not making use of performance-enhancing features like MetalFX upscaling. When a non-native game runs through these layers of translation, its performance and power efficiency may be affected.
Bringing your game natively to the Mac will increase its performance and allow you to take advantage of many advanced features of Apple silicon and Mac hardware, including features like MetalFX and extended dynamic range features of Apple’s built-in displays. A great workflow for evaluating a game is to play it with the Metal Performance HUD enabled and to look for specific spots that might warrant a deeper look. The developers found a spot where the HUD is showing occasional dropped frames as well as much lower average frame rate. They are then able to use Instruments to capture a Metal System Trace. This is a great way to investigate performance issues. The Metal Performance HUD has been enhanced when you are running in the Game Porting Toolkit. The standard portion of the HUD is still at the top. It shows information about the GPU and resolution being rendered, the instantaneous frame rate, present-to-present interval, and an approximation of the amount of GPU time being used. It highlights high and low values of these statistics, shows memory usage, and provides a graph of the last few seconds of data. Below, the HUD now shows deeper details about instruction set translation and which Direct3D API version is being used, how many render encoders are in use, how many command buffers and dispatches are happening, and how many of each type of features, such as geometry shaders and tessellation shaders, are being used each frame. Additionally, resource copies and clears are captured. Here they open the trace file in Instruments and then browse to quickly find where we see frame drops. Here it is, an area where the GPU timeline has huge gaps and little utilization and there were several frames where no work was scheduled at all. After studying this, it looks very likely to be caused by the overhead of instruction translation or differences caused by API translation. These are just the kinds of problems that will go away when you bring your game to Mac natively. You can be sure your game will have better performance and run more efficiently. Additionally, using best practices for rendering in Metal and adopting MetalFX upscaling will boost your game’s performance even further. Here is "The Medium’s" native version running side by side with the translated version, making more optimal use of Metal 3 and Apple Silicon for a dramatic improvement in frame rate in this scene. To get started using the Game Porting Toolkit, just head to developer.apple.com. You’ll find a package containing instructions for building and configuring the tool kit so you can begin evaluating your game. You can provide your feedback, questions, and suggestions about the Game Porting Toolkit and bringing your game to Mac using Feedback Assistant. Now that you’ve evaluated your graphics features and performance by running your existing Windows game, take that knowledge to port your shader pipeline.
You can use Metal Shader Converter tool to convert all your game’s advanced shading pipelines, including geometry, tessellation, mesh, and ray tracing stages. Compiling your shaders is a deep topic on its own, so when you’re ready, watch the second talk in this series, “Compile Your Shaders.” It’s time to take a look at rendering with Metal.
Metal 3 provides all of the advanced graphics and compute features, including MetalFX, fast resource loading, offline compilation, mesh shaders, and ray tracing, used by modern high-end games, which makes converting your graphics code incredibly straightforward. The third session in the series, “Render with Metal,” is about how to port your renderer to Metal and get great performance out of Apple Silicon. You evaluated your game’s basic input features through the Game Porting Toolkit. Now it's time to port it natively and take advantage of advanced features like rumble and haptics.
Your Windows game is either already built over a cross-platform game engine and making use of common input plug-ins, or it’s making direct use of low-level Windows APIs like XInput and GameInput, or it may bundle a custom SDK for game peripherals. On Apple platforms, the Game Controller framework provides your game with thread-safe and low latency support for game input across a wide variety of peripherals, such as game pads, keyboards, mice, racing wheels, and arcade sticks. You also have access to additional capabilities of game controllers, including haptics and motion. Apple platforms provides system-level user preferences support for per-app input remapping, as well as automatic support for screenshots, capturing video recordings, and 15-second highlights of gameplay right from a controller in any game. It is easy to port your game’s input logic. When you’re ready to learn more, these two prior talks, “Tap into Virtual and Physical Game Controllers” and “Advancements in Game Controllers,” are great places to find details and sample code. Audio is another key part of a captivating game experience. Bringing your existing game’s audio workflow and features natively to the Mac is quite straightforward. Apple devices have state-of-the-art built-in speakers that your players can hear loud and clear because there are no loud fans drowning them out. There are also many excellent wired and wireless audio peripherals compatible with Apple devices which support low latency spatial audio. Your existing game likely already uses cross-platform audio middleware solutions like Wwise, Unity, and FMOD. These middleware products generally abstract system audio APIs and frameworks. On Windows, you may be using middleware layers over lower-level APIs like DirectSound, XAudio2, and WASAPI. Those same middleware products exist on Apple platforms. These make use of a rich set of high and low-level Apple audio frameworks including Spatial Mixer Audio Unit, PHASE, and AVAudioEngine. Great news: you’ll find that all these middleware products are well supported with native Apple Silicon SDKs. There is little or nothing you will need to do. But if you’re not using middleware, of course you can use the platform-provided audio frameworks and APIs directly, just like the middleware does. In particular, to achieve great spatial audio at this level, check out the PHASE documentation as well as the sample code which demonstrates creating spatial audio from a 12-channel, 7.1.4 PCM data using AUSpatialMixer. These previous talks about CoreAudio, AudioUnits, and PHASE are also great sessions to learn about using low-level system frameworks if your game is not based on audio middleware. Apple’s displays are an integral part of providing your players with a stunning and immersive gaming experience. With the Game Porting Toolkit, you can see your game's rendering code running over the basic standard dynamic range and frame pacing APIs of its translated environment. On Windows, your game might be making use of color management and tone mapping APIs to achieve high dynamic range, such as AdvancedColorInfo color space APIs. And you might be using the timing and feedback available in IDXGISwapChain to pace your SDR and HDR content. CAMetalLayer’s extended dynamic range support gives you access to even more advanced display features. You can easily move your HDR and tone mapping logic, whether it’s based on floating-point or 10-bit integer range, or HDR10 or PQ10 shaders. The CAMetalDisplayLink API gives you fine-grained control to achieve lowest input and display latency for your game. Check out these talks about adding EDR support to your Metal rendering. “Explore EDR on iOS” is a great talk which recaps the pixel formats and Metal APIs to use which are consistent between macOS and iOS. The “Explore HDR Rendering with EDR” presentation offers a great foundation for understanding how to make most of EDR APIs and capabilities. Apple Silicon Mac platforms have all the software and hardware features you need to bring your game to the Mac. With the Game Porting Toolkit and Metal Shader Converter, bringing your game to the Mac is easier than ever. Be sure to keep going with part two, “Compile Your Shaders,” and part three, “Render with Metal.” I can’t wait to play your games on the Mac. ♪ ♪
-
-
Looking for something specific? Enter a topic above and jump straight to the good stuff.
An error occurred when submitting your query. Please check your Internet connection and try again.