Post on 01-Dec-2014
description
You know the drill
but I have to say it:
The views I express here do not necessarily reflect those of my employer.
(But, we are recruiting!)
Overview
● Low overhead● Unified graphics and compute shaders● Efficient multithreading● Designed for A7 & A8
○ iPhone 5S, 6, 6+○ iPad Mini Retina
Setting up texturing in OpenGLglGenTextures(1, &texName);glBindTexture(GL_TEXTURE_2D, texName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
Design Goals
● Thinnest API Possible● Modern GPU features● Predictable performance● Explicit control over commands● Do expensive tasks less often
Demo
Why GPU programming is expensive
● State validation● Shader compilation● Sending work to the GPU
Metal Objects
● Device● Command Queue● Command Buffer● Command Encoder● State● Code● Resources
Command Submission Model
● Convert API commands into hardware commands
● Three types of command encoders○ Compute○ Blit○ Render
Resource Update Model
Designed for the unified memory system of iOS devices.CPU and GPU share the exact same storage.Two types of resources:● Textures (formatted images)● Buffers (unformatted bytes)
Command Encoder Types
● Render● Compute● Blit
Render Command Encoder
● Combines all commands for a single FBO● State● No more “draw time” compilation
Compute Command Encoder
● Called the compute kernel● Local atomics● Barriers● Memory loads and stores● User-specified workgroup dimensions
Blit Command Encoder
Enables async copies in parallel with graphics and compute
Metal Shading Language
Unified shading language for graphics and compute
C++11
Multiple shaders per source file
Argument Tables
Textures, buffers, and samplers passed as arguments to functions
Each command encoder includes a set of Argument Tables
Developer Tools
● Shader compiler● Visual frame debugger● API trace and navigation● Live shader editing● Graphics and compute state inspection● Debug mode!
Thanks!
● To all of you for attending!
● Steve Derico for organizing!
● My colleagues at Kamcord for their unending
support!