NcStudios / NcEngine

NcEngine: 3D game engine written in modern C++ and Vulkan
https://ncstudios.itch.io/
MIT License
36 stars 2 forks source link

Refactor updating of descriptor sets - hidden requirement for pointer stability #656

Open jaremieromer opened 3 weeks ago

jaremieromer commented 3 weeks ago

In ShaderStorage, calling m_shaderBindingManager->UpdateImage or m_shaderBindingManager->UpdateBuffer will fail unless the buffer types in ShaderStorage are wrapped in unique_ptr, preserving pointer stability during move operations.

The cause is DescriptorBufferInfo and DescriptorImageInfo required by those update calls require pointers to vk::Buffer for vk::ImageInfo which are currently cached inside of the buffer types, which live in sparse_maps.

This should be refactored to some combination of:

A) Make the pointer stability requirement clear B) Remove the pointer stability requirement by swapping ownership of the info types. C) Change how much of the descriptor info we are caching.