172
#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

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

  • Upload
    others

  • View
    36

  • Download
    1

Embed Size (px)

Citation preview

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

#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

•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

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

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

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

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

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

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

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

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

•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

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

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

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

•“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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// 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

// 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

// 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

// 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// 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

// 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

// 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

// 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

// 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

// 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

•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

•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

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

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

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

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

// 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

// 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

// 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// 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

// 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

// 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

// 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

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

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

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

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

- (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

- (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

- (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

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

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

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

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

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

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

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

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

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

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

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

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

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