WWDC15 Graphics and Games

WWDC15 Graphics and Games

Graphics and Games #WWDC15 What’s New in Metal, Part 1 Session 603 Rav Dhiraj GPU Software © 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Metal in Review Metal Dramatically reduced overhead Precompiled shaders Graphics and compute Efficient multithreading Metal Game Dramatically reduced overhead Precompiled shaders Graphics and compute OpenGL Efficient multithreading Metal Dramatically reduced overhead Precompiled shaders Game Graphics and compute Metal Efficient multithreading Frame Time with CPU as the Bottleneck 0 ms 33.3 ms 50 ms Application GPU API CPU frame N frame N GPU Work GPU frame N-1 Frame Time with CPU as the Bottleneck 0 ms 33.3 ms 50 ms Application GPU API CPU frame N frame N GPU Work GPU Idle Time GPU frame N-1 Metal Reduces GPU API Overhead 0 ms 20 ms 33.3 ms Application GPU API CPU frame N frame N GPU Work GPU frame N-1 Metal Reduces GPU API Overhead 0 ms 20 ms 33.3 ms Application CPU CPU frame N Idle Time GPU Work GPU frame N-1 Improve Your Game 0 ms 20 ms 33.3 ms Application More Physics CPU CPU frame N More AI Idle Time GPU Work GPU frame N-1 Or Issue More Draw Calls 0 ms 33.3 ms Application More Physics CPU frame N More AI Up to 10x More Draw Calls GPU Work GPU frame N-1 Or Issue More Draw Calls 0 ms 33.3 ms Application More Physics CPU frame N More AI Up to 10x More Draw Calls GPU Work GPU frame N-1 Metal Draw Time Dramatically reduced overhead Build Time Load Time 1000s per “Never” Infrequent Frame Precompiled shaders Graphics and compute Shader Compilation Efficient multithreading State Validation Metal Draw Time Dramatically reduced overhead Build Time Load Time 1000s per “Never” Infrequent Frame Precompiled shaders Graphics and compute Shader Compilation Efficient multithreading State Validation Metal Draw Time Dramatically reduced overhead Build Time Load Time 1000s per “Never” Infrequent Frame Precompiled shaders Graphics and compute Shader Compilation Efficient multithreading State Validation Metal Dramatically reduced overhead Render Command Precompiled shaders Encoder Graphics and compute Compute Command Encoder Efficient multithreading Render Command Encoder Command Buffer Metal Dramatically reduced overhead Render Command Precompiled shaders Encoder Graphics and compute Compute Command Encoder Efficient multithreading Render Command Encoder Command Buffer Metal Dramatically reduced overhead Thread 1 Pass 1 Command Precompiled shaders Encoder Graphics and compute Efficient multithreading Pass 2 Command Encoder Pass 3 Command Encoder t Metal Dramatically reduced overhead Thread 1 Thread 2 Thread 3 Pass 1 Command Pass 3 Precompiled shaders Encoder Command Pass 2 Encoder Command Graphics and compute Encoder Efficient multithreading t Your App 2D Graphics Standards-Based High-Efficiency Scene Graphs and Imaging 3D Graphics GPU Access SceneKit Core Animation SpriteKit Core Image Core Graphics OpenGL ES Metal GPU Your App 2D Graphics High-Efficiency Scene Graphs and Imaging GPU Access SceneKit Core Animation SpriteKit Core Image Core Graphics Metal GPU Broad Support for Metal Tools Support Frame Debugger Shader Profiler Shader Editor State Inspector Driver Instruments API Analysis Tools Metal OS X Metal OS X Minimal code change required for existing iOS applications Metal OS X Minimal code change required for existing iOS applications • Device selection Metal OS X Minimal code change required for existing iOS applications • Device selection • Support for Discrete Memory Metal OS X Minimal code change required for existing iOS applications • Device selection • Support for Discrete Memory • New texture formats for desktop GPUs Adopting Metal on OS X The Foundry Jack Greasley Courtesy of Framestore, Heyday films, and StudioCanal © The Witcher 3. Image courtesy of Platige Image. Courtesy of Adidas Day One Day One Day Five Day Five Day Fifteen Day Fifteen Day Twenty Day Twenty Day Twenty-Five Day Twenty-Five What did we learn? New Features Device Selection New Compressed Texture Formats Texture Barriers New Texture Features MetalKit Layer Select Metal Performance Shaders Counting Occlusion Queries New Memory Model Multi-sample Depth resolves Depth Clipping Support GPU Family Sets Draw and Compute Indirect Metal System Trace Tool Separate front/back stencil reference values New Shader Constant Update APIs Device Selection New Compressed Texture Formats Texture Barriers New Texture Features MetalKit Layer Select Metal Performance Shaders Counting Occlusion Queries New Memory Model Multi-sample Depth resolves Depth Clipping Support GPU Family Sets Draw and Compute Indirect Metal System Trace Separate front/back stencil reference values New Shader Constant Update APIs Device Selection New Compressed Texture Formats Texture Barriers New Texture Features MetalKit Layer Select Metal Performance Shaders Counting Occlusion Queries New Memory Model Multi-sample Depth resolves Depth Clipping Support GPU Family Sets Draw and Compute Indirect Metal System Trace Tool Separate front/back stencil reference values New Shader Constant Update APIs Metal Feature Set Definitions Metal Feature Set Definitions Feature sets represent a collection of capabilities by GPU generation iOS_GPUFamily2_v1 Metal Feature Set Definitions Feature sets represent a collection of capabilities by GPU generation • Prefix defines the platform iOS_GPUFamily2_v1 Metal Feature Set Definitions Feature sets represent a collection of capabilities by GPU generation • Prefix defines the platform • Family Name is unique to a hardware generation iOS_GPUFamily2_v1 Metal Feature Set Definitions Feature sets represent a collection of capabilities by GPU generation • Prefix defines the platform • Family Name is unique to a hardware generation • Revision number can change as features are added over time iOS_GPUFamily2_v1 Metal Feature Set Definitions Simple query to see if device supports a given feature set Metal Feature Set Definitions Simple query to see if device supports a given feature set [myMetalDevice supportsFeatureSet:iOS_GPUFamily2_v1] iOS Metal Feature Sets Name Introduced Feature Additions Supported Devices iOS_GPUFamily1_v1 iOS 8 Core Metal features for A7 devices iPhone 5s New texture features iPad Air Multi-sample depth resolves iPhone 6 and 6 Plus iOS_GPUFamily1_v2 iOS 9 Depth clipping support iPad Air 2 Separate stencil reference values iOS_GPUFamily2_v1 iOS 8 ASTC texture support New texture features iPhone 6 and 6 Plus Multi-sample depth resolves iPad Air 2 iOS_GPUFamily2_v2 iOS 9 Depth clipping support Separate stencil reference values OS X Metal Feature Sets Name Introduced Feature Additions Supported Devices Same core feature as iOS, plus BCn texture compression formats Combined depth stencil formats Managed resource model Multi-GPU device selection Draw and compute indirect OSX_GPUFamily1_v1 OS X 10.11 counting occlusion queries All Macs since 2012 Layer select Texture barriers New texture features Multi-sample depth resolves Depth clipping support Separate stencil reference values Shader Constant Updates Shader Constant Updates Command Buffer Draw 1 Draw 2 Draw 3 Draw n Shader Constant Updates Command Buffer Shader Draw 1 Constants 1 Constant Data Draw 2 for Draw 2 Constant Data Draw 3 for Draw 3 Constant Data Draw n for Draw n Shader Constant Updates Constant Buffer Command Buffer Shader Draw 1 Constants 1 Constant Data Draw 2 for Draw 2 Constant Data Draw 3 for Draw 3 Constant Data Draw n for Draw n Shader Constant Updates Constant Buffer Command Buffer Shader Draw 1 Constants 1 Constant Data Draw 2 for Draw 2 Constant Data Draw 3 for Draw 3 Constant Data Draw n for Draw n Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer = …; MyConstants* constant_ptr = constant_buffer.contents; for (i=0; i<draw_count; i++) { constant_ptr[i] = // write constants directly into the buffer [render_pass setVertexBuffer:constant_buffer offset:i*sizeof(MyConstants) atIndex:0]; // draw } Shader Constant Updates Bind per draw id <MTLBuffer> constant_buffer

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    191 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us