It's Not About the API
Fast, Flexible, and Simple Rendering in Vulkan
Mason Remaley, 2024
Introduction
Graphics APIs
What is a graphics API?
Modern Graphics APIs
| Vulkan | DirectX | Metal |
Windows | ✔ | ✔ | ✗ |
Linux | ✔ | ✗ | ✗ |
macOS | ~ | ✗ | ✔ |
XBox | ✗ | ✔ | ✗ |
Playstation | ✗ | ✗ | ✗ |
Switch | ✔ | ✗ | ✗ |
| Vulkan | DirectX | Metal |
Managed by nonprofit and runs the most places | ✔ | ✗ | ✗ |
A Brief History of Graphics APIs
<1992
1992
2004
2014
Vendor specific APIs, e.g. IRIS GL
IRIS GL becomes OpenGL
Move from fixed function to shader model
GPGPU increasingly relevant, modern APIs closer to the metal
A triangle with fixed function OpenGL…
https://www.ics.com/blog/fixed-function-modern-opengl-part-3-4
A triangle with Vulkan…
https://github.com/SaschaWillems/Vulkan/blob/master/examples/triangle/triangle.cpp
LOOK at what Graphic Programmers have been demanding your Respect for all this time, with all the 3080s & RTXs we built for them
(This is REAL graphics, done by REAL graphics programmers):
"Hello I would like 10 graphics compute transfer present queues please"
They have played us for absolute fools
Vulkan
This Is What Peak Performance Looks Like
also it's simpler
Outline
Vulkan Concepts
Vulkan Devices
Command Buffers
Pipelines
Swapchains
Synchronization
Memory Management
Takeaway
Fast, Flexible, and Simple Rendering in Vulkan
High Level Strategy: Two Lenses
High Level Strategy: Two Lenses
Memory Management
Vertex Data
Uniforms
Draw Call Generation
Materials
Materials: Details
// Example data layout
struct MaterialInstance {
u16 material; // Which material are we
u16 data_1; // Misc material data
u32 data_2; // Misc material data, OR extra data index
};
// GLSL union tip
layout(binding = 1) readonly buffer FooMats { FooMat foo_mats[]; };
layout(binding = 1) readonly buffer BarMats { BarMat bar_mats[]; };
Summary
TLDR: fill up a few memory mapped buffers, issue a single draw call
What this gets us?
Things we skipped…
Sounds nice, is this actually fast though?
What makes a good API?
What makes a good API?
📷 Useful Links
Slides