Blender V5.0
blender::gpu::render_graph::VKResourceStateTracker Class Reference

#include <vk_resource_state_tracker.hh>

Public Member Functions

ResourceWithStamp get_image_and_increase_stamp (VkImage vk_image)
ResourceWithStamp get_buffer_and_increase_stamp (VkBuffer vk_buffer)
ResourceWithStamp get_buffer (VkBuffer vk_buffer) const
ResourceWithStamp get_image (VkImage vk_image) const
VKResourceType resource_type_get (ResourceHandle resource_handle) const
void debug_print () const
Remove resources
void remove_image (VkImage vk_image)
void remove_buffer (VkBuffer vk_buffer)

Public Attributes

Mutex mutex
bool use_dynamic_rendering_local_read = true

Friends

class VKCommandBuilder
struct VKRenderGraphLink
class VKScheduler

Adding resources

void add_buffer (VkBuffer vk_buffer, const char *name=nullptr)
void add_image (VkImage vk_image, bool use_subresource_tracking, const char *name=nullptr)
void add_swapchain_image (VkImage vk_image, const char *name=nullptr)

Detailed Description

Class to track resources.

Resources are tracked on device level. Their are two kind of resources, namely buffers and images. Each resource can have multiple versions; every time a resource is changed (written to) a new version is tracked.

Definition at line 98 of file vk_resource_state_tracker.hh.

Member Function Documentation

◆ add_buffer()

void blender::gpu::render_graph::VKResourceStateTracker::add_buffer ( VkBuffer vk_buffer,
const char * name = nullptr )

Register a buffer resource.

When a buffer is created in VKBuffer, it needs to be registered in the device resources so the resource state can be tracked during its lifetime.

Definition at line 77 of file vk_resource_state_tracker.cc.

References BLI_assert_msg, blender::gpu::render_graph::BUFFER, lock, mutex, name, resource, and UNUSED_VARS_NDEBUG.

Referenced by blender::gpu::VKBuffer::create().

◆ add_image()

void blender::gpu::render_graph::VKResourceStateTracker::add_image ( VkImage vk_image,
bool use_subresource_tracking,
const char * name = nullptr )

Register an image resource.

When an image is created in VKTexture, it needs to be registered in the device resources so the resource state can be tracked during its lifetime.

Definition at line 59 of file vk_resource_state_tracker.cc.

References add_image(), and name.

Referenced by add_image(), and add_swapchain_image().

◆ add_swapchain_image()

void blender::gpu::render_graph::VKResourceStateTracker::add_swapchain_image ( VkImage vk_image,
const char * name = nullptr )

Definition at line 66 of file vk_resource_state_tracker.cc.

References add_image(), and name.

◆ debug_print()

void blender::gpu::render_graph::VKResourceStateTracker::debug_print ( ) const

Definition at line 201 of file vk_resource_state_tracker.cc.

◆ get_buffer()

ResourceWithStamp blender::gpu::render_graph::VKResourceStateTracker::get_buffer ( VkBuffer vk_buffer) const

◆ get_buffer_and_increase_stamp()

ResourceWithStamp blender::gpu::render_graph::VKResourceStateTracker::get_buffer_and_increase_stamp ( VkBuffer vk_buffer)

Return the current stamp of the resource, and increase the stamp.

When a node writes to a buffer, this method is called to increase the stamp of the buffer. The node that writes to the buffer will use the current stamp as its input, but generate the new stamp for future nodes.

This function is called when adding a node to the render graph, during building resource dependencies. See VKNodeInfo.build_links

Definition at line 155 of file vk_resource_state_tracker.cc.

References resource.

Referenced by blender::gpu::render_graph::VKCopyBufferNode::build_links(), blender::gpu::render_graph::VKCopyImageToBufferNode::build_links(), blender::gpu::render_graph::VKFillBufferNode::build_links(), blender::gpu::render_graph::VKResourceAccessInfo::build_links(), and blender::gpu::render_graph::VKUpdateBufferNode::build_links().

◆ get_image()

ResourceWithStamp blender::gpu::render_graph::VKResourceStateTracker::get_image ( VkImage vk_image) const

Return the current stamp of the resource.

When a node reads from an image, this method is called to get the current stamp the image.

This function is called when adding a node to the render graph, during building resource dependencies. See VKNodeInfo.build_links

Definition at line 169 of file vk_resource_state_tracker.cc.

References resource.

Referenced by blender::gpu::render_graph::VKBlitImageNode::build_links(), blender::gpu::render_graph::VKCopyImageNode::build_links(), blender::gpu::render_graph::VKCopyImageToBufferNode::build_links(), and blender::gpu::render_graph::VKResourceAccessInfo::build_links().

◆ get_image_and_increase_stamp()

ResourceWithStamp blender::gpu::render_graph::VKResourceStateTracker::get_image_and_increase_stamp ( VkImage vk_image)

Return the current stamp of the resource, and increase the stamp.

When a node writes to an image, this method is called to increase the stamp of the image. The node that writes to the image will use the current stamp as its input, but generate a new stamp for future nodes.

This function is called when adding a node to the render graph, during building resource dependencies. See VKNodeInfo.build_links

Definition at line 148 of file vk_resource_state_tracker.cc.

References resource.

Referenced by blender::gpu::render_graph::VKBlitImageNode::build_links(), blender::gpu::render_graph::VKClearColorImageNode::build_links(), blender::gpu::render_graph::VKClearDepthStencilImageNode::build_links(), blender::gpu::render_graph::VKCopyBufferToImageNode::build_links(), blender::gpu::render_graph::VKCopyImageNode::build_links(), blender::gpu::render_graph::VKResourceAccessInfo::build_links(), blender::gpu::render_graph::VKSynchronizationNode::build_links(), and blender::gpu::render_graph::VKUpdateMipmapsNode::build_links().

◆ remove_buffer()

void blender::gpu::render_graph::VKResourceStateTracker::remove_buffer ( VkBuffer vk_buffer)

Remove an registered buffer.

When a buffer is destroyed by calling vmaDestroyBuffer, a call to remove_buffer is needed to unregister the resource from state tracking.

Definition at line 105 of file vk_resource_state_tracker.cc.

References lock, and mutex.

Referenced by blender::gpu::VKDiscardPool::destroy_discarded_resources(), and blender::gpu::VKBuffer::free_immediately().

◆ remove_image()

void blender::gpu::render_graph::VKResourceStateTracker::remove_image ( VkImage vk_image)

Remove an registered image.

When a image is destroyed by calling vmaDestroyImage, a call to remove_image is needed to unregister the resource from state tracking.

Definition at line 117 of file vk_resource_state_tracker.cc.

References lock, and mutex.

Referenced by blender::gpu::VKDiscardPool::destroy_discarded_resources().

◆ resource_type_get()

VKResourceType blender::gpu::render_graph::VKResourceStateTracker::resource_type_get ( ResourceHandle resource_handle) const
inline

Get the resource type for the given handle.

Definition at line 254 of file vk_resource_state_tracker.hh.

◆ VKCommandBuilder

friend class VKCommandBuilder
friend

Definition at line 101 of file vk_resource_state_tracker.hh.

References VKCommandBuilder.

Referenced by VKCommandBuilder.

◆ VKRenderGraphLink

friend struct VKRenderGraphLink
friend

Definition at line 102 of file vk_resource_state_tracker.hh.

References VKRenderGraphLink.

Referenced by VKRenderGraphLink.

◆ VKScheduler

friend class VKScheduler
friend

Definition at line 103 of file vk_resource_state_tracker.hh.

References VKScheduler.

Referenced by VKScheduler.

Member Data Documentation

◆ mutex

Mutex blender::gpu::render_graph::VKResourceStateTracker::mutex

Device resource mutex

The mutex is stored in resources due to:

  • It protects resources and their state.
  • Allowing test cases to do testing without setting up a device instance which requires ghost.
  • Device instance isn't accessible in test cases.

Definition at line 174 of file vk_resource_state_tracker.hh.

Referenced by add_buffer(), remove_buffer(), remove_image(), and blender::gpu::VKDevice::submission_runner().

◆ use_dynamic_rendering_local_read

bool blender::gpu::render_graph::VKResourceStateTracker::use_dynamic_rendering_local_read = true

The documentation for this class was generated from the following files: