Vulkan: Render graph textures #120821
|
@ -283,11 +283,11 @@ set(VULKAN_SRC
|
|||
vulkan/render_graph/vk_nodes.hh
|
||||
vulkan/render_graph/vk_resource_access_info.hh
|
||||
vulkan/render_graph/vk_resource_dependencies.hh
|
||||
vulkan/render_graph/vk_resource_handles.hh
|
||||
vulkan/render_graph/vk_resources.hh
|
||||
vulkan/render_graph/vk_scheduler.hh
|
||||
vulkan/render_graph/vk_render_graph.hh
|
||||
vulkan/render_graph/vk_types.hh
|
||||
vulkan/vk_resource_handles.hh
|
||||
vulkan/vk_resource_tracker.hh
|
||||
vulkan/vk_sampler.hh
|
||||
vulkan/vk_samplers.hh
|
||||
|
|
|
@ -21,7 +21,7 @@ class VKCommandBuilder;
|
|||
|
||||
class VKNodes {
|
||||
private:
|
||||
VKResourceList<NodeHandle, VKNodeData> nodes_;
|
||||
VKResourceHandles<NodeHandle, VKNodeData> nodes_;
|
||||
|
||||
public:
|
||||
template<typename NodeClass, typename NodeCreateInfo>
|
||||
|
|
|
@ -13,21 +13,24 @@
|
|||
|
||||
#include "vk_common.hh"
|
||||
|
||||
namespace blender::gpu {
|
||||
namespace blender::gpu::render_graph {
|
||||
|
||||
/**
|
||||
* List for working with handles and items.
|
||||
* Reference to the first empty slot is stored internally to stop iterating over all the elements.
|
||||
*/
|
||||
// TODO: Also keep track of last filled position to reduce the amount of items as_span/size will
|
||||
// return
|
||||
template<typename Handle, typename Item> class VKResourceList {
|
||||
template<typename Handle, typename Item> class VKResourceHandles {
|
||||
private:
|
||||
const int64_t grow_size_ = 64;
|
||||
Handle first_empty_slot_ = 0;
|
||||
Vector<std::optional<Item>> items_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Allocate a new handle.
|
||||
*
|
||||
* It can reuse a previous freed handle.
|
||||
*/
|
||||
Handle allocate()
|
||||
{
|
||||
Handle handle = first_empty_slot_;
|
||||
|
@ -90,4 +93,4 @@ template<typename Handle, typename Item> class VKResourceList {
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace blender::gpu
|
||||
} // namespace blender::gpu::render_graph
|
|
@ -100,7 +100,7 @@ class VKResources {
|
|||
}
|
||||
};
|
||||
|
||||
VKResourceList<ResourceHandle, Resource> resources_;
|
||||
VKResourceHandles<ResourceHandle, Resource> resources_;
|
||||
Map<VkImage, ResourceHandle> image_resources_;
|
||||
Map<VkBuffer, ResourceHandle> buffer_resources_;
|
||||
|
||||
|
|
Loading…
Reference in New Issue