Blender V4.3
vk_render_graph.hh File Reference
#include <mutex>
#include <optional>
#include <pthread.h>
#include "BKE_global.hh"
#include "BLI_map.hh"
#include "BLI_utility_mixins.hh"
#include "BLI_vector.hh"
#include "BLI_vector_set.hh"
#include "vk_common.hh"
#include "vk_command_buffer_wrapper.hh"
#include "vk_command_builder.hh"
#include "vk_render_graph_links.hh"
#include "vk_resource_state_tracker.hh"
#include "vk_resource_tracker.hh"

Go to the source code of this file.

Classes

class  blender::gpu::render_graph::VKRenderGraph
 

Namespaces

namespace  blender
 
namespace  blender::gpu
 
namespace  blender::gpu::render_graph
 

Macros

#define ADD_NODE(NODE_CLASS)
 

Detailed Description

The render graph primarily is a a graph of GPU commands that are then serialized into command buffers. The submission order can be altered and barriers are added for resource sync.

Building render graph

The graph contains nodes that refers to resources it reads from, or modifies. The resources that are read from are linked to the node inputs. The resources that are written to are linked to the node outputs.

Resources needs to be tracked as usage can alter the content of the resource. For example an image can be optimized for data transfer, or optimized for sampling which can use a different pixel layout on the device.

When adding a node to the render graph the input and output links are extracted from the See VKNodeInfo::build_links.

Executing render graph

Executing a render graph is done by calling submit_for_read or submit_for_present. When called the nodes that are needed to render the resource are determined by a VKScheduler. The nodes are converted to vkCmd* and recorded in the command buffer by VKCommandBuilder.

Thread safety

When the render graph is called the device will be locked. Nodes inside the render graph relies on the resources which are device specific. The locked time is tiny when adding new nodes. During execution this takes a longer time, but the lock can be released when the commands have been queued. So other threads can continue.

Definition in file vk_render_graph.hh.

Macro Definition Documentation

◆ ADD_NODE

#define ADD_NODE ( NODE_CLASS)
Value:
void add_node(const NODE_CLASS::CreateInfo &create_info) \
{ \
add_node<NODE_CLASS>(create_info); \
}
static bNode * add_node(const bContext *C, bNodeTree *ntree, const int type, const float locx, const float locy)

Definition at line 175 of file vk_render_graph.hh.