Storing Vulkan objects
In the previous recipes, we mentioned a plethora of lvk::…Handle
classes wrapped into a templated unique-pointer-like class Holder<>
. These are central to how LightweightVK manages Vulkan objects and other resources. Handles are lightweight value types that are inexpensive to pass around as integers, and we don’t incur the overhead of shared ownership with atomic counters, as we would with std::shared_ptr
or other reference-counted smart pointers. When ownership of an object is desirable, we wrap handles into the Holder<>
class, which is a RAII wrapper and conceptually resembles 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 it: https://advances.realtimerendering.com/s2023/AaltonenHypeHypeAdvances2023...