Storing Vulkan objects
In the previous recipes, we mentioned a plethora of lvk::…Handle
classes wrapped in a unique-pointer-like class lvk::Holder
. They are central to how LightweightVK manages Vulkan objects and other resources. Handles are lightweight value types that are cheap to pass around as integers and we pay no costs of shared ownership with atomic counters compared to std::shared_ptr
and similar reference-counted smart pointers. When having ownership of some object is desirable, we wrap handles in the lvk::Holder
class, which conceptually is similar to std::unique_ptr
.
Getting ready
The LightweightVK implementation of handles is inspired by Sebastian Aaltonen`s SIGGRAPH 2023 presentation HypeHype Mobile Rendering Architecture. If you want to learn more low-level interesting details about an API design using handles, make sure to read: https://advances.realtimerendering.com/s2023/AaltonenHypeHypeAdvances2023.pdf.
How to do it…
An abstract handle is represented...