rav dhiraj, gpu software - apple inc....rav dhiraj, gpu software •vr with metal 2 •session 603...
TRANSCRIPT
![Page 1: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/1.jpg)
#WWDC17
© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
Rav Dhiraj, GPU Software
•VR with Metal 2 •Session 603
Graphics and Games
![Page 2: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/2.jpg)
•VR Support in macOS •Developing VR Apps •External GPU support
![Page 3: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/3.jpg)
What is Virtual Reality?
Immersive 360° 3D experience
Direct object manipulation
Interactive environment
Motion tracking
![Page 4: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/4.jpg)
Enabled with Metal 2
![Page 5: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/5.jpg)
Enabled with Metal 2
Direct to display capability for VR Headsets
![Page 6: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/6.jpg)
Enabled with Metal 2
Direct to display capability for VR Headsets
Targeted features for VR
![Page 7: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/7.jpg)
Enabled with Metal 2
Direct to display capability for VR Headsets
Targeted features for VR
Foundational support for External GPUs
![Page 8: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/8.jpg)
Platform Support
HTC Vive Head Mounted Display
Valve SteamVR runtime
Valve OpenVR Framework
NEW
![Page 9: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/9.jpg)
VR Compositor Image warping for HMD optics
![Page 10: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/10.jpg)
VR Compositor Image warping for HMD optics
![Page 11: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/11.jpg)
•Building a VR App
![Page 12: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/12.jpg)
Building a VR App Two options
![Page 13: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/13.jpg)
Building a VR App Two options
Game engine with VR support • Hides VR compositor complexity • Familiar toolchain
![Page 14: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/14.jpg)
Building a VR App Two options
Game engine with VR support • Hides VR compositor complexity • Familiar toolchain
Build your own native VR app • Full control of rendering and synchronization
![Page 15: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/15.jpg)
![Page 16: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/16.jpg)
![Page 17: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/17.jpg)
![Page 18: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/18.jpg)
•“Overall, the porting of Space Pirate Trainer to macOS with Unity went very smooth. We had it running on macOS under a couple of hours”
•Dirk Van Welden, I-Illusions
![Page 19: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/19.jpg)
Native SteamVR App
Custom app built using the OpenVR Framework
Binaries and documentation available on GitHub
macOS sample code available soon
Application
OpenVR Framework
HMD and Controllers
SteamVR Runtime
![Page 20: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/20.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 21: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/21.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 22: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/22.jpg)
Traditional Workload Non-VR
VBL VBL
GPU
VBL
![Page 23: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/23.jpg)
Traditional Workload Non-VR
60 fps target
VBL VBL
GPU
VBL
![Page 24: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/24.jpg)
Traditional Workload Non-VR
60 fps target
16.7 ms available frame time
16.7 ms
VBL VBL
GPU
VBL
![Page 25: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/25.jpg)
Traditional Workload Non-VR
60 fps target
16.7 ms available frame time
Entire frame time available for GPU work
Frame 1
16.7 ms
VBL VBL
GPU
VBL
Frame 0
![Page 26: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/26.jpg)
VBL
GPU
VR Workload Frame time differences
VBL VBL
![Page 27: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/27.jpg)
VBL
GPU
VR Workload Frame time differences
90 fps target • Reduces frame time to 11.1 ms
11.1 ms
VBLVBL VBL
![Page 28: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/28.jpg)
VBL
GPU
VR Workload Frame time differences
90 fps target • Reduces frame time to 11.1 ms
Additional GPU work by VR compositor
App 1
11.1 ms
VBL
App 2App 0 0 1 2
VBL VBL
![Page 29: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/29.jpg)
VBL
GPU
VR Workload Frame time differences
90 fps target • Reduces frame time to 11.1 ms
Additional GPU work by VR compositor
App 1
11.1 ms
VBL
App 2App 0 0 1 2
1 ms
VBL VBL
![Page 30: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/30.jpg)
VBL
GPU
VR Workload Frame time differences
90 fps target • Reduces frame time to 11.1 ms
Additional GPU work by VR compositor • ~10ms frame time budget for your app
App 1
11.1 ms
VBL
App 2App 0 0 1 2
10 ms 1 ms
VBL VBL
![Page 31: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/31.jpg)
VR Workload More work every frame
![Page 32: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/32.jpg)
VR Workload More work every frame
Rendering the scene twice • Left and right eye
![Page 33: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/33.jpg)
VR Workload More work every frame
Rendering the scene twice • Left and right eye
Rendering at higher resolution • HTC Vive headset: 2160x1200 • Commonly supersample at 1.2 to 1.4x when rendering
![Page 34: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/34.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 35: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/35.jpg)
Direct to Display
Low latency path that bypasses the Window Server
VR Compositor presents directly to the HMD
NEW
![Page 36: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/36.jpg)
Direct to Display
Low latency path that bypasses the Window Server
VR Compositor presents directly to the HMD
NEW
VR headsets not exposed as regular displays
![Page 37: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/37.jpg)
Present to Display macOS 10.12
App
Metal
macOS Window Server
Display
![Page 38: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/38.jpg)
Present to Headset macOS 10.13 with Metal 2
App
macOS Window Server
VR App
VR Compositor (eg. SteamVR)
Display HMD
Metal 2 Metal 2
![Page 39: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/39.jpg)
Selecting a Metal Device
![Page 40: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/40.jpg)
Selecting a Metal Device
SteamVR selects the device attached to the VR Headset
![Page 41: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/41.jpg)
Selecting a Metal Device
SteamVR selects the device attached to the VR Headset
Apps should select the same Metal device
![Page 42: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/42.jpg)
Selecting a Metal Device
SteamVR selects the device attached to the VR Headset
Apps should select the same Metal device
id<MTLDevice> vrDevice = nil; vrSystem->GetOutputDevice((uint64_t*)&vrDevice, vr::TextureType_IOSurface);
![Page 43: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/43.jpg)
L
R
VR Compositor
Managing Surfaces
LL
RR
App VR Compositor
App
![Page 44: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/44.jpg)
L
R
VR Compositor
Managing Surfaces
LL
RR
App VR Compositor
RenderApp
![Page 45: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/45.jpg)
L
R
VR CompositorSubmit
Managing Surfaces
LL
RR
App VR Compositor
RenderApp
![Page 46: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/46.jpg)
L
RWarpVR
CompositorSubmit
Managing Surfaces
LL
RR
App VR Compositor
RenderApp
![Page 47: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/47.jpg)
PresentL
RWarpVR
CompositorSubmit
Managing Surfaces
LL
RR
App VR Compositor
RenderApp
![Page 48: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/48.jpg)
PresentL
RWarpVR
CompositorSubmit
Managing Surfaces
LL
RR
App VR Compositor
Render
IOSurfaces
App
![Page 49: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/49.jpg)
// Creating Metal Textures
MTLTextureDescriptor *textureDesc = [MTLTextureDescriptor new]; textureDesc.width = vrWidth; textureDesc.height = vrHeight; textureDesc.pixelFormat = MTLPixelFormatRGBA8Unorm_sRGB; textureDesc.storageMode = MTLStorageModeManaged; textureDesc.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
id <MTLTexture> right_tex = [device newTextureWithDescriptor:textureDesc iosurface:rightIOSurface plane:0]; id <MTLTexture> left_tex = [device newTextureWithDescriptor:textureDesc iosurface:leftIOSurface plane:0];
![Page 50: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/50.jpg)
// Creating Metal Textures
MTLTextureDescriptor *textureDesc = [MTLTextureDescriptor new]; textureDesc.width = vrWidth; textureDesc.height = vrHeight; textureDesc.pixelFormat = MTLPixelFormatRGBA8Unorm_sRGB; textureDesc.storageMode = MTLStorageModeManaged; textureDesc.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
id <MTLTexture> right_tex = [device newTextureWithDescriptor:textureDesc iosurface:rightIOSurface plane:0]; id <MTLTexture> left_tex = [device newTextureWithDescriptor:textureDesc iosurface:leftIOSurface plane:0];
![Page 51: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/51.jpg)
// Creating Metal Textures
MTLTextureDescriptor *textureDesc = [MTLTextureDescriptor new]; textureDesc.width = vrWidth; textureDesc.height = vrHeight; textureDesc.pixelFormat = MTLPixelFormatRGBA8Unorm_sRGB; textureDesc.storageMode = MTLStorageModeManaged; textureDesc.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
id <MTLTexture> right_tex = [device newTextureWithDescriptor:textureDesc iosurface:rightIOSurface plane:0]; id <MTLTexture> left_tex = [device newTextureWithDescriptor:textureDesc iosurface:leftIOSurface plane:0];
![Page 52: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/52.jpg)
// Creating Metal Textures
MTLTextureDescriptor *textureDesc = [MTLTextureDescriptor new]; textureDesc.width = vrWidth; textureDesc.height = vrHeight; textureDesc.pixelFormat = MTLPixelFormatRGBA8Unorm_sRGB; textureDesc.storageMode = MTLStorageModeManaged; textureDesc.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
id <MTLTexture> right_tex = [device newTextureWithDescriptor:textureDesc iosurface:rightIOSurface plane:0]; id <MTLTexture> left_tex = [device newTextureWithDescriptor:textureDesc iosurface:leftIOSurface plane:0];
![Page 53: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/53.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 54: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/54.jpg)
VR Compositor Synchronization
VR compositor and App work in lock step • Results of App rendering submitted to VR compositor
GPU is a shared resource • Submission order matters
![Page 55: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/55.jpg)
VR Compositor Synchronization Start of frame
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
![Page 56: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/56.jpg)
VR Compositor Synchronization Start of frame
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
WaitGetPoses()
![Page 57: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/57.jpg)
VR Compositor Synchronization Start of frame
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode
WaitGetPoses()
![Page 58: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/58.jpg)
VR Compositor Synchronization Submit to VR compositor
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode
![Page 59: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/59.jpg)
VR Compositor Synchronization Submit to VR compositor
App Render
Commit
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode
![Page 60: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/60.jpg)
Submit x2
VR Compositor Synchronization Submit to VR compositor
App Render
Commit
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode
![Page 61: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/61.jpg)
VR Compositor Synchronization Guaranteeing submission order
App Render
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode/Encode
![Page 62: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/62.jpg)
VR Compositor Synchronization Guaranteeing submission order
App Render
Scheduled
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode/Encode
![Page 63: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/63.jpg)
VR Compositor Synchronization Guaranteeing submission order
App Render
Scheduled PostPresentHandoff()
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode/Encode
![Page 64: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/64.jpg)
VR Compositor Synchronization Guaranteeing submission order
App Render
Scheduled PostPresentHandoff()
Commit
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode/Encode
![Page 65: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/65.jpg)
VR Compositor Synchronization Guaranteeing submission order
App Render
Scheduled PostPresentHandoff()
Commit
Warp
Encode
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
Encode/Encode
![Page 66: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/66.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 67: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/67.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 68: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/68.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 69: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/69.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 70: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/70.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 71: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/71.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 72: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/72.jpg)
vr.VRCompositor()->WaitGetPoses(vrTrackedDevicePoses, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
id<MTLCommandBuffer> commandBuffer = [sceneCommandQueue commandBuffer];
// render left and right eye images into eyeTextures [self _drawSceneWithCommandBuffer:commandBuffer];
[commandBuffer commit];
vr.VRCompositor()->Submit(vr::Eye_Left, &eyeTextures[0], &vrEyeBounds[0]); vr.VRCompositor()->Submit(vr::Eye_Right, &eyeTextures[1], &vrEyeBounds[1]);
// wait until the GPU work is scheduled [commandBuffer waitUntilScheduled];
// signal to the compositor that it can submit work to the GPU vr.VRCompositor()->PostPresentHandoff();
![Page 73: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/73.jpg)
VR Compositor Synchronization Frame cadence
App Render
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
WGP()WGP()
EncodeEncode
Warp
Encode
![Page 74: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/74.jpg)
VR Compositor Synchronization Frame cadence
App Render
VBL VBL
App
GPU
11.1 ms
MetalCPU
VR Compositor
WGP()WGP()
11.1 ms
EncodeEncode
Warp
Encode
![Page 75: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/75.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 76: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/76.jpg)
Start Early
App
VBL
App
CPU
GPU
Vc
Vc
VBL
No Running Start
Idle
![Page 77: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/77.jpg)
Start Early
CPU work at frame start can introduce “GPU bubbles”
App
VBL
App
CPU
GPU
Vc
Vc
VBL
No Running Start
Idle
![Page 78: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/78.jpg)
Start Early
CPU work at frame start can introduce “GPU bubbles”
SteamVR provides a mechanism to start early
With Running Start
VBL
Vc
Vc
VBL
App0
App0
App1 Vc
App1
App
VBL
App
CPU
GPU
Vc
Vc
VBL
No Running Start
Idle
![Page 79: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/79.jpg)
Start Early
CPU work at frame start can introduce “GPU bubbles”
SteamVR provides a mechanism to start early
Encode your frame after WaitGetPoses returns
WGP WGP
With Running Start
VBL
Vc
Vc
VBL
App0
App0
App1 Vc
App1
App
VBL
App
CPU
GPU
Vc
Vc
VBL
No Running Start
Idle
![Page 80: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/80.jpg)
Split Your Command Buffers
App
VBL
App
CPU
GPU
Vc
Vc
VBL
Single CB
Idle
![Page 81: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/81.jpg)
Split Your Command Buffers
Avoid submitting monolithic command buffers
App
VBL
App
CPU
GPU
Vc
Vc
VBL
Single CB
Idle
![Page 82: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/82.jpg)
Split Your Command Buffers
Avoid submitting monolithic command buffers
Split and submit as you go to maximize GPU utilization
Vc
Vc
1
1
2
2 3
3 4
4
Split CB
VBL VBL
App
VBL
App
CPU
GPU
Vc
Vc
VBL
Single CB
Idle
![Page 83: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/83.jpg)
Coalesce Left and Right Eye Draws
![Page 84: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/84.jpg)
Coalesce Left and Right Eye Draws
Use the Metal 2 Viewport Array feature • Per-primitive viewport selection in the vertex shader
NEW
![Page 85: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/85.jpg)
Coalesce Left and Right Eye Draws
Use the Metal 2 Viewport Array feature • Per-primitive viewport selection in the vertex shader
Render to left and right eye with a single draw call
NEW
![Page 86: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/86.jpg)
// Each viewport will cover half the texture size MTLViewport vrViewports[2];
vrViewports[0].originX = 0; vrViewports[0].originY = 0; vrViewports[0].width = width; vrViewports[0].height = height; vrViewports[0].znear = 0.0; vrViewports[0].zfar = 1.0;
vrViewports[1].originX = width; vrViewports[1].originY = 0; vrViewports[1].width = width; vrViewports[1].height = height; vrViewports[1].znear = 0.0; vrViewports[1].zfar = 1.0;
Height
2 x Width
![Page 87: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/87.jpg)
// Each viewport will cover half the texture size MTLViewport vrViewports[2];
vrViewports[0].originX = 0; vrViewports[0].originY = 0; vrViewports[0].width = width; vrViewports[0].height = height; vrViewports[0].znear = 0.0; vrViewports[0].zfar = 1.0;
vrViewports[1].originX = width; vrViewports[1].originY = 0; vrViewports[1].width = width; vrViewports[1].height = height; vrViewports[1].znear = 0.0; vrViewports[1].zfar = 1.0;
(0, 0)
(width, height)
Height
2 x Width
![Page 88: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/88.jpg)
// Each viewport will cover half the texture size MTLViewport vrViewports[2];
vrViewports[0].originX = 0; vrViewports[0].originY = 0; vrViewports[0].width = width; vrViewports[0].height = height; vrViewports[0].znear = 0.0; vrViewports[0].zfar = 1.0;
vrViewports[1].originX = width; vrViewports[1].originY = 0; vrViewports[1].width = width; vrViewports[1].height = height; vrViewports[1].znear = 0.0; vrViewports[1].zfar = 1.0;
(width, 0)
(width, height)
Height
2 x Width
![Page 89: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/89.jpg)
// Set the viewports on your render command encoder for that render pass [renderEncoder setViewports:vrViewports count:2];
// The instance_id will be used as the "eye" index [renderEncoder drawIndexedPrimitives:primitiveType indexCount:count indexType:type indexBuffer:buffer indexBufferOffset:offset instanceCount:2];
![Page 90: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/90.jpg)
// Set the viewports on your render command encoder for that render pass [renderEncoder setViewports:vrViewports count:2];
// The instance_id will be used as the "eye" index [renderEncoder drawIndexedPrimitives:primitiveType indexCount:count indexType:type indexBuffer:buffer indexBufferOffset:offset instanceCount:2];
![Page 91: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/91.jpg)
// Set the viewports on your render command encoder for that render pass [renderEncoder setViewports:vrViewports count:2];
// The instance_id will be used as the "eye" index [renderEncoder drawIndexedPrimitives:primitiveType indexCount:count indexType:type indexBuffer:buffer indexBufferOffset:offset instanceCount:2];
![Page 92: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/92.jpg)
typedef struct { float4 position [[ position ]]; … ushort viewport [[ viewport_array_index ]]; } ColorInOut;
// Vertex Shader treats instance_id as an eye index vertex ColorInOut VS(Vertex in [[ stage_in ]], constant AAPLUniforms& uniforms [[ buffer(kBufferIndexUniforms) ]], ushort iid [[ instance_id ]]) { ColorInOut out; out.position = uniforms.modelViewProjectionMatrix[iid] * float4(in.position, 1.0); … out.viewport = iid; return out; }
![Page 93: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/93.jpg)
typedef struct { float4 position [[ position ]]; … ushort viewport [[ viewport_array_index ]]; } ColorInOut;
// Vertex Shader treats instance_id as an eye index vertex ColorInOut VS(Vertex in [[ stage_in ]], constant AAPLUniforms& uniforms [[ buffer(kBufferIndexUniforms) ]], ushort iid [[ instance_id ]]) { ColorInOut out; out.position = uniforms.modelViewProjectionMatrix[iid] * float4(in.position, 1.0); … out.viewport = iid; return out; }
![Page 94: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/94.jpg)
typedef struct { float4 position [[ position ]]; … ushort viewport [[ viewport_array_index ]]; } ColorInOut;
// Vertex Shader treats instance_id as an eye index vertex ColorInOut VS(Vertex in [[ stage_in ]], constant AAPLUniforms& uniforms [[ buffer(kBufferIndexUniforms) ]], ushort iid [[ instance_id ]]) { ColorInOut out; out.position = uniforms.modelViewProjectionMatrix[iid] * float4(in.position, 1.0); … out.viewport = iid; return out; }
![Page 95: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/95.jpg)
typedef struct { float4 position [[ position ]]; … ushort viewport [[ viewport_array_index ]]; } ColorInOut;
// Vertex Shader treats instance_id as an eye index vertex ColorInOut VS(Vertex in [[ stage_in ]], constant AAPLUniforms& uniforms [[ buffer(kBufferIndexUniforms) ]], ushort iid [[ instance_id ]]) { ColorInOut out; out.position = uniforms.modelViewProjectionMatrix[iid] * float4(in.position, 1.0); … out.viewport = iid; return out; }
![Page 96: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/96.jpg)
typedef struct { float4 position [[ position ]]; … ushort viewport [[ viewport_array_index ]]; } ColorInOut;
// Vertex Shader treats instance_id as an eye index vertex ColorInOut VS(Vertex in [[ stage_in ]], constant AAPLUniforms& uniforms [[ buffer(kBufferIndexUniforms) ]], ushort iid [[ instance_id ]]) { ColorInOut out; out.position = uniforms.modelViewProjectionMatrix[iid] * float4(in.position, 1.0); … out.viewport = iid; return out; }
![Page 97: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/97.jpg)
Render Fewer Pixels
![Page 98: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/98.jpg)
Render Fewer Pixels
15% of rendered pixels not displayed
![Page 99: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/99.jpg)
Render Fewer Pixels
15% of rendered pixels not displayed
Use SteamVR stencil mask to clip these pixels
![Page 100: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/100.jpg)
VR App Building 101
Overview of VR development
macOS platform specifics
Anatomy of a VR frame
VR best practices
![Page 101: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/101.jpg)
VR on macOS
•Nat Brown, Valve Software
![Page 102: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/102.jpg)
VR Motivation
VR is a long-term investment for Valve
360 + room scale + input = magical
Valve licenses VR tech non-exclusively
![Page 103: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/103.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
VR application
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
![Page 104: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/104.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
VR application
![Page 105: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/105.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
VR application
![Page 106: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/106.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
VR application
![Page 107: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/107.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
VR application
![Page 108: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/108.jpg)
SteamVR Architecture
shared memory state and shared textures + high-frequency poses and input events
vrserver vrcompositor vrdashboard
vrclient
vrmonitor
Metal
HMD and Controllers
OpenVR APIs
device drivers
VR application
![Page 109: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/109.jpg)
SteamVR on macOS
Closer engagement with Apple started Summer 2016
Bringing the compositor to Metal only took a few weeks
Adopted the Metal 2 Direct to Display APIs
![Page 110: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/110.jpg)
Simulation / Prep 5 Simulation / Prep 6 Simulation / Prep 7
Submit 5 Submit 6 Submit 7Submit 4
Running Start
SteamVR on macOS
VBL VBL
Simulation Prediction to Photons ~36 ms returned by GetDeviceToAbsoluteTrackingPose()
Rendering Prediction to Photons returned by WaitGetPoses()
Panel photons photons photons photons
GPURender 5 Render 6 Render 7Render 4
54 63 vrcompositor
CPU
VBLWaitGetPoses()
returns
VBL
90Hz - 11.1ms
![Page 111: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/111.jpg)
Where to get SteamVR
Install Steam and create a free account • http://store.steampowered.com/
Under Library / Tools, install SteamVR
Opt into the SteamVR Beta • Right-Click SteamVR, choose “Properties” • Choose “beta - SteamVR Beta Update”
Download OpenVR headers & framework • https://github.com/ValveSoftware/openvr
![Page 112: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/112.jpg)
Using OpenVR in Your App
Include OpenVR.framework inside your app bundle • Conveys version to the SteamVR runtime
• Add OpenVR.Framework to Embedded Binaries under General settings
• Xcode will automatically set the Runtime Search Path appropriately for your bundle
![Page 113: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/113.jpg)
Feedback and Support
![Page 114: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/114.jpg)
•Nat Brown, Valve Software
![Page 115: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/115.jpg)
•External GPU Support
![Page 116: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/116.jpg)
Background
External chassis with a desktop class GPU
Connected to host via Thunderbolt
![Page 117: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/117.jpg)
Goals
Enable VR development
![Page 118: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/118.jpg)
Goals
Enable VR development
Performance improvement in other GPU bound cases
![Page 119: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/119.jpg)
External Graphics Developer Kit
Sonnet 350W external GPU Chassis
AMD Radeon RX 580 GPU
Optimized for Thunderbolt 3 capable Macs
Available for purchase today
![Page 120: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/120.jpg)
// Identifying the External GPU
id<MTLDevice> externalGPU = nil; NSArray<id<MTLDevice>> * availableDevices = MTLCopyAllDevices(); for (id <MTLDevice> device in availableDevices) { if (device.removable) { externalGPU = device; return; } }
![Page 121: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/121.jpg)
// Identifying the External GPU
id<MTLDevice> externalGPU = nil; NSArray<id<MTLDevice>> * availableDevices = MTLCopyAllDevices(); for (id <MTLDevice> device in availableDevices) { if (device.removable) { externalGPU = device; return; } }
![Page 122: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/122.jpg)
// Identifying the External GPU
id<MTLDevice> externalGPU = nil; NSArray<id<MTLDevice>> * availableDevices = MTLCopyAllDevices(); for (id <MTLDevice> device in availableDevices) { if (device.removable) { externalGPU = device; return; } }
![Page 123: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/123.jpg)
Thunderbolt 3 Bandwidth
Relative Bandwidth
1x 2x
Thunderbolt 2
![Page 124: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/124.jpg)
Thunderbolt 3 Bandwidth
Twice the bandwidth capability of Thunderbolt 2
Relative Bandwidth
1x 2x
Thunderbolt 2
Thunderbolt 3
![Page 125: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/125.jpg)
Relative Bandwidth
1x 2x 3x 4x 5x 6x 7x 8x
Thunderbolt 3 Bandwidth
Twice the bandwidth capability of Thunderbolt 2
25% the bandwidth of PCIe x16
Thunderbolt 2
Thunderbolt 3
PCIe x16
![Page 126: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/126.jpg)
MacBook Pro
System RAM
Intel Chipset
GPU Power vs. Bandwidth
![Page 127: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/127.jpg)
MacBook Pro
System RAM
Intel Chipset
Internal GPU VRAM
GPU Power vs. Bandwidth
![Page 128: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/128.jpg)
MacBook Pro
System RAM
Intel Chipset
Thunderbolt 3 External GPU VRAM
Internal GPU VRAM
GPU Power vs. Bandwidth
![Page 129: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/129.jpg)
MacBook Pro
System RAM
Intel Chipset
Thunderbolt 3 External GPU VRAM
Internal GPU VRAM
GPU Power vs. Bandwidth
Treat the GPU and link as a pair
Optimal combination will depend on workload
![Page 130: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/130.jpg)
Complex Display Topology
![Page 131: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/131.jpg)
Complex Display Topology
Displays connected to different GPUs
![Page 132: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/132.jpg)
Complex Display Topology
Displays connected to different GPUs
Performance impact to render on one GPU and display on another
![Page 133: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/133.jpg)
Complex Display Topology
Displays connected to different GPUs
Performance impact to render on one GPU and display on another
Where your content is displayed matters
![Page 134: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/134.jpg)
Golden Rule for GPU Selection
Render on the same GPU your app displays on
MacBook Pro
System RAM
Intel Chipset
TBT3 External GPU VRAM
Internal GPU VRAM Display
Display
![Page 135: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/135.jpg)
GPU Selection Decision Tree
![Page 136: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/136.jpg)
Presenting to Display
GPU Selection Decision Tree
![Page 137: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/137.jpg)
Select GPU attached to
Display
YesPresenting to Display
GPU Selection Decision Tree
![Page 138: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/138.jpg)
Select GPU attached to
Display
YesNo (eg. Compute)
Prefer low power
Presenting to Display
GPU Selection Decision Tree
![Page 139: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/139.jpg)
Select LowPower
GPU
YesSelect GPU attached to
Display
YesNo (eg. Compute)
Prefer low power
Presenting to Display
GPU Selection Decision Tree
![Page 140: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/140.jpg)
Select LowPower
GPU
Yes
Select external
GPU
NoSelect GPU attached to
Display
YesNo (eg. Compute)
Prefer low power
Presenting to Display
GPU Selection Decision Tree
![Page 141: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/141.jpg)
Select LowPower
GPU
Yes
Select external
GPU
NoSelect GPU attached to
Display
YesNo (eg. Compute)
Prefer low power
Presenting to Display
Select LowPower
GPU
Select external
GPU
Prefer low power
Presenting to Display
GPU Selection Decision Tree
Select GPU attached to
Display
![Page 142: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/142.jpg)
Metal Device from Display
Use existing CoreGraphics API
// Get the CGDirectDisplayID for the display your app window is on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue];
// query CG for the metal device id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
![Page 143: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/143.jpg)
Metal Device from Display
Use existing CoreGraphics API
// Get the CGDirectDisplayID for the display your app window is on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue];
// query CG for the metal device id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
![Page 144: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/144.jpg)
Metal Device from Display
Use existing CoreGraphics API
// Get the CGDirectDisplayID for the display your app window is on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue];
// query CG for the metal device id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
![Page 145: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/145.jpg)
GPU Migration
![Page 146: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/146.jpg)
GPU Migration
Display migration may require GPU migration
![Page 147: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/147.jpg)
GPU Migration
Display migration may require GPU migration
Register for NSWindowDidChangeScreenNotification • Triggered when windows move across displays
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScreenChanges:) name:NSWindowDidChangeScreenNotification object:nil];
![Page 148: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/148.jpg)
// Get the Metal device for the GPU driving the display your app is now on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue]; id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
// Early out if this display is being driven by the same GPU if (currentDevice == newPreferredDevice) return;
// switch view to new device view.device = newPreferredDevice;
// handle App migration to the new GPU
// Call draw on this new device [MetalKitRenderer draw:view];
![Page 149: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/149.jpg)
// Get the Metal device for the GPU driving the display your app is now on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue]; id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
// Early out if this display is being driven by the same GPU if (currentDevice == newPreferredDevice) return;
// switch view to new device view.device = newPreferredDevice;
// handle App migration to the new GPU
// Call draw on this new device [MetalKitRenderer draw:view];
![Page 150: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/150.jpg)
// Get the Metal device for the GPU driving the display your app is now on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue]; id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
// Early out if this display is being driven by the same GPU if (currentDevice == newPreferredDevice) return;
// switch view to new device view.device = newPreferredDevice;
// handle App migration to the new GPU
// Call draw on this new device [MetalKitRenderer draw:view];
![Page 151: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/151.jpg)
// Get the Metal device for the GPU driving the display your app is now on NSNumber* num = view.window.screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID viewDisplayID = [num unsignedIntegerValue]; id<MTLDevice> newPreferredDevice = CGDirectDisplayCopyCurrentMetalDevice(viewDisplayID);
// Early out if this display is being driven by the same GPU if (currentDevice == newPreferredDevice) return;
// switch view to new device view.device = newPreferredDevice;
// handle App migration to the new GPU
// Call draw on this new device [MetalKitRenderer draw:view];
![Page 152: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/152.jpg)
Attach and Removal Notifications New with Metal 2
MTLDeviceWasAddedNotification
MTLDeviceWasRemovedNotification
MTLDeviceRemovalRequestedNotification
NEW
![Page 153: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/153.jpg)
NSArray< id<MTLDevice> >* devices = nil; id<NSObject> metalDeviceObserver = nil; devices = MTLCopyAllDevicesWithObserver(&metalDeviceObserver, ^(id<MTLDevice> device, MTLNotificationName name) { [self handleGPUHotPlug:device notifier:name]; });
NEW
![Page 154: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/154.jpg)
NSArray< id<MTLDevice> >* devices = nil; id<NSObject> metalDeviceObserver = nil; devices = MTLCopyAllDevicesWithObserver(&metalDeviceObserver, ^(id<MTLDevice> device, MTLNotificationName name) { [self handleGPUHotPlug:device notifier:name]; });
NEW
![Page 155: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/155.jpg)
NSArray< id<MTLDevice> >* devices = nil; id<NSObject> metalDeviceObserver = nil; devices = MTLCopyAllDevicesWithObserver(&metalDeviceObserver, ^(id<MTLDevice> device, MTLNotificationName name) { [self handleGPUHotPlug:device notifier:name]; });
NEW
![Page 156: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/156.jpg)
- (void)handleGPUHotPlug:(id<MTLDevice>)device notifier:(MTLNotificationName)notifier { if (notifier == MTLDeviceWasAddedNotification) // Device plugged in else if (notifier == MTLDeviceRemovalRequestedNotification) // Device Removal Requested. Cleanup and switch to preferred device else if (notifier == MTLDeviceWasRemovedNotification) // additional handling of surprise removal }
NEW
![Page 157: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/157.jpg)
- (void)handleGPUHotPlug:(id<MTLDevice>)device notifier:(MTLNotificationName)notifier { if (notifier == MTLDeviceWasAddedNotification) // Device plugged in else if (notifier == MTLDeviceRemovalRequestedNotification) // Device Removal Requested. Cleanup and switch to preferred device else if (notifier == MTLDeviceWasRemovedNotification) // additional handling of surprise removal }
NEW
![Page 158: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/158.jpg)
- (void)handleGPUHotPlug:(id<MTLDevice>)device notifier:(MTLNotificationName)notifier { if (notifier == MTLDeviceWasAddedNotification) // Device plugged in else if (notifier == MTLDeviceRemovalRequestedNotification) // Device Removal Requested. Cleanup and switch to preferred device else if (notifier == MTLDeviceWasRemovedNotification) // additional handling of surprise removal }
NEW
![Page 159: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/159.jpg)
Unexpected GPU Removal
![Page 160: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/160.jpg)
Unexpected GPU Removal
Metal API will return errors on GPU removal
Survive until a GPU migration notification
Regenerate data in GPU local memory
![Page 161: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/161.jpg)
Best Practices
![Page 162: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/162.jpg)
Best Practices
Retain devices after migration
![Page 163: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/163.jpg)
Best Practices
Retain devices after migration
Manage GPU migration for each window
![Page 164: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/164.jpg)
Best Practices
Retain devices after migration
Manage GPU migration for each window
Avoid transferring data between GPUs
![Page 165: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/165.jpg)
VR Best Practices
![Page 166: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/166.jpg)
VR Best Practices
Attach the VR headset to the external GPU
![Page 167: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/167.jpg)
VR Best Practices
Attach the VR headset to the external GPU
Present to a display driven by the external GPU
![Page 168: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/168.jpg)
VR Best Practices
Attach the VR headset to the external GPU
Present to a display driven by the external GPU
Cache resources on the external GPU
![Page 169: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/169.jpg)
Summary
VR development enabled with Metal 2
Support for HTC Vive and SteamVR
VR enabled game engines or build a native VR app
External GPU support
![Page 170: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/170.jpg)
Related Sessions
Introducing Metal 2 Executive Ballroom Tuesday 1:50PM
Metal 2 Optimization and Debugging Executive Ballroom Thursday 3:15PM
Using Metal 2 for Compute Grand Ballroom A Thursday 4:10PM
![Page 171: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/171.jpg)
Metal Labs
Metal 2 Lab Technology Lab A Tues 3:10PM–6:00PM
VR with Metal 2 Lab Technology Lab A Wed 3:10PM–6:00PM
Metal 2 Lab Technology Lab F Fri 9:00AM–12:00PM
![Page 172: Rav Dhiraj, GPU Software - Apple Inc....Rav Dhiraj, GPU Software •VR with Metal 2 •Session 603 Graphics and Games • VR Support in macOS • Developing VR Apps • External GPU](https://reader030.vdocuments.us/reader030/viewer/2022033123/5f0ef5507e708231d441c78a/html5/thumbnails/172.jpg)