The Modern Vulkan Cookbook: A practical guide to 3D graphics and advanced real-time rendering techniques in Vulkan 9781803239989

Vulkan is a graphics API that gives the program total control of the GPU, allowing the GPU to be used to its full potent

149 31 13MB

English Pages 418 Year 2024

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
The Modern Vulkan Cookbook
Contributors
About the authors
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Sections
Getting ready
How to do it…
How it works…
There’s more…
See also
Get in touch
Reviews
Share Your Thoughts
Download a free PDF copy of this book
1
Vulkan Core Concepts
Technical requirements
Getting to know the Vulkan API
Calling API functions
Getting ready
How to do it…
Learning about Vulkan objects
Getting ready
How to do it…
Using Volk to load Vulkan functions and extensions
Getting ready
How to do it…
Using Vulkan extensions correctly
Getting ready
How to do it…
Using the Validation Layer for error checking
Getting ready
How to do it…
Enumerating available instance layers
Getting ready
How to do it…
Enumerating available instance extensions
Getting ready
How to do it…
Initializing the Vulkan instance
Getting ready
How to do it…
Creating a surface
Getting ready
How to do it…
Enumerating Vulkan physical devices
Getting ready
How to do it…
Caching the properties of queue families
Getting ready
How to do it…
Enumerating physical device extensions
Getting ready
How to do it…
Reserving queue families
Getting ready
How to do it…
Creating a Vulkan logical device
Getting ready
How to do it…
Retrieving the queue object handle
Getting ready
How to do it…
Creating a command pool
Getting ready
How to do it…
Allocating, recording, and submitting commands
Getting ready
How to do it…
Reusing command buffers
Getting ready
How to do it…
Creating render passes
Getting ready
How to do it…
Creating framebuffers
Getting ready
How to do it…
Creating image views
Getting ready
How to do it…
The Vulkan graphics pipeline
How to do it...
Compiling shaders to SPIR-V
Getting ready
How to do it…
Dynamic states
Getting ready
How to do it…
Creating a graphics pipeline
Getting ready
How to do it…
Swapchain
Getting ready
How to do it…
Understanding synchronization in the swapchain – fences and semaphores
Getting ready
How to do it…
Populating submission information for presentation
Getting ready
How to do it…
Presenting images
Getting ready
How to do it…
Rendering a triangle
Getting ready
How to do it…
2
Working with Modern Vulkan
Technical requirements
Understanding Vulkan’s memory model
Getting ready
How to do it…
Instantiating the VMA library
How to do it…
Creating buffers
Getting ready
How to do it…
Uploading data to buffers
Getting ready
How to do it…
Creating a staging buffer
Getting ready
How to do it…
How to avoid data races using ring buffers
Getting ready
How to do it…
Setting up pipeline barriers
Getting ready
How to do it…
Creating images (textures)
Getting ready
How to do it…
Creating an image view
Getting ready
How to do it…
Creating a sampler
Getting ready
How to do it…
Providing shader data
Getting ready
How to do it…
Specifying descriptor sets with descriptor set layouts
Getting ready
How to do it…
Passing data to shaders using push constants
Getting ready
How to do it…
Creating a pipeline layout
Getting ready
How to do it…
Creating a descriptor pool
Getting ready
How to do it…
Allocating descriptor sets
Getting ready
How to do it…
Updating descriptor sets during rendering
Getting ready
How to do it…
Passing resources to shaders (binding descriptor sets)
Getting ready
How to do it…
Updating push constants during rendering
Getting ready
How to do it…
Customizing shader behavior with specialization constants
Getting ready
How to do it…
Implementing MDI and PVP
Implementing MDI
Getting ready
How to do it…
Using PVP
Getting ready
How to do it…
Adding flexibility to the rendering pipeline using dynamic rendering
Getting ready
How to do it…
Transferring resources between queue families
Getting ready
How to do it…
3
Implementing GPU-Driven Rendering
Technical requirements
Implementing GPU-driven line rendering
Getting ready
How to do it…
Expanding line-drawing techniques to render textual values from shaders
Getting ready
How to do it…
Drawing text using SDF
Getting ready
How to do it…
See also
Frustum culling using compute shaders
Getting ready
How to do it…
How it works…
4
Exploring Techniques for Lighting, Shading, and Shadows
Technical requirements
Implementing G-buffer for deferred rendering
Getting ready
How to do it...
Implementing screen space reflections
Getting ready
How to do it...
See also
Implementing shadow maps for real-time shadows
Getting ready
How to do it...
There’s more …
See also
Implementing screen space ambient occlusion
Getting ready
How to do it...
See also
Implementing a lighting pass for illuminating the scene
Getting ready
How to do it…
5
Deciphering Order-Independent Transparency
Technical requirements
Implementing Depth-Peeling
Getting ready
How to do it…
Implementing Dual Depth-Peeling
Getting ready
How to do it…
Implementing Linked-List Order-Independent Transparency
Getting ready
How to do it…
There’s more…
See also
Implementing Weighted Order-Independent Transparency
Getting ready
How to do it…
There’s more…
See also
6
Anti-Aliasing Techniques
Technical requirements
Enabling and using Vulkan’s MSAA
Getting ready
How to do it...
Applying FXAA
Getting ready
How to do it...
Utilizing TAA
Getting ready
How to do it...
Applying DLSS
Getting ready
How to do it...
See also
7
Ray Tracing and Hybrid Rendering
Technical requirements
Implementing a GPU ray tracer
Monte Carlo method
Getting ready
How to do it...
See also
Implementing hybrid rendering
Getting ready
How to do it...
8
Extended Reality with OpenXR
Technical requirements
Getting started with OpenXR
Getting ready
How to do it…
See also
How to implement single pass multiview rendering
Getting ready
How to do it…
Implementing static foveated rendering with a fragment density map
Getting ready
How to do it…
See also
Retrieving eye gaze information from OpenXR in your app
Getting ready
How to do it…
Implementing dynamic foveated rendering using Qualcomm’s fragment density map Offset extension
Getting ready
How to do it…
Using half floats to reduce memory load
Getting ready
How to do it…
9
Debugging and Performance Measurement Techniques
Technical requirements
Frame debugging
Getting ready
How to do it…
See also
Naming Vulkan objects for easy debugging
Getting ready
How to do it…
Printing values from shaders in Vulkan
Getting ready
How to do it…
Intercepting validation layer messages
Getting ready
How to do it…
Retrieving debug information from shaders
Getting ready
How to do it…
Measuring performance in Vulkan with timestamp queries
Getting ready
How to do it…
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book

The Modern Vulkan Cookbook: A practical guide to 3D graphics and advanced real-time rendering techniques in Vulkan
 9781803239989

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers