Tux Machines

Improving Vulkan graphics state tracking in Mesa

Posted by Roy Schestowitz on Sep 07, 2022

=> today's howtos | Red Hat Leftovers

=> ↺ Jason Ekstrand

3D rendering APIs such as OpenGL, D3D, and Vulkan involve a lot of state to drive the 3D pipeline. Even though most of the heavy lifting these days is done by programmable shaders, there are still many fixed-function pieces used to glue those shaders together. This includes things such as fetching vertex data and loading it into the vertex shader at the start of the pipeline, viewport transforms and clipping that sit between the end of the geometry pipeline and rasterization, and depth/stencil testing and color blending that happen at the end of the pipeline before writing the final image to the output buffers. Each of these fixed-function pieces is configurable and so has some amount of state associated with it.

In OpenGL, the 3D rendering pipeline is modeled as one giant blob of state where everything is re-configurable at any time. It's left to the driver to track state changes and re-configure the hardware as needed. With Vulkan, we improved this situation quite a bit by baking much of the state into immutable objects. Images and samplers, for instance, have all their parameters provided at the time the image or sampler is created and they are immutable from then on. (The color or depth/stencil data pointed to by an image is mutable but the core parameters such as width, height, number of miplevels, etc. are not.) The only state mutability with respect to these objects is the ability to change which images/samplers are bound at any given time. Compiled shaders, along with the state for fixed function pieces such as depth/stencil testing, are all rolled up into a single monolithic pipeline object. Because fully monolithic pipeline objects can be cumbersome, Vulkan also provides the option to make some of that state dynamic, meaning that you set it manually via a vkCmdSet*() command instead of baking it into the pipeline. his allows the client to use the same pipeline object with, for instance, different blend constants.

Read on

=> ↺ Read on

=> gemini.tuxmachines.org

Proxy Information
Original URL
gemini://gemini.tuxmachines.org/n/2022/09/07/Improving_Vulkan_graphics_state_tracking_in_Mesa.gmi
Status Code
Success (20)
Meta
text/gemini;lang=en-GB
Capsule Response Time
139.66744 milliseconds
Gemini-to-HTML Time
0.641205 milliseconds

This content has been proxied by September (ba2dc).