VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | List of all members
vpp::Process Class Reference

Represents process graph node. More...

#include <vppRenderGraphNodes.hpp>

Public Member Functions

 Process ()
 Constructs process node for currently defined graph. More...
 
 Process (RenderGraph *pGraph)
 Constructs process node for specified graph. More...
 
 Process (RenderGraph *pGraph, std::uint32_t index)
 Constructs process node for specified graph. More...
 
std::uint32_t index () const
 Retrieves the index of the Process node. More...
 
RenderGraphgraph () const
 Retrieves the parent render graph.
 
template<class FormatT >
void addColorOutput (const Attachment< FormatT > &d, const typename FormatT::init_type &initValue, VkImageLayout destLayout=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
 Adds color output attachment to be produced from scratch. Any previous content of the attachment is destroyed. More...
 
template<class FormatT >
void addReusedColorOutput (const Attachment< FormatT > &d, VkImageLayout destLayout=VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
 Adds color output attachment which has been already filled by previous render passes, to be modified by this render pass. More...
 
void addColorOutput (const Display &d)
 Adds color output attachment for display image. More...
 
void addColorOutput (const Display &d, const VkClearColorValue &color)
 Adds color output attachment for display image. More...
 
template<class FormatT >
void setDepthOutput (const Attachment< FormatT > &d, const typename FormatT::init_type &initValue, VkImageLayout preserveInLayout=VK_IMAGE_LAYOUT_UNDEFINED)
 Sets depth attachment to be produced from scratch. Any previous content of the attachment is destroyed. More...
 
template<class FormatT >
void setReusedDepthOutput (const Attachment< FormatT > &d, VkImageLayout preserveInLayout=VK_IMAGE_LAYOUT_UNDEFINED)
 Sets depth attachment which has been already filled by previous render passes, to be modified by this render pass. More...
 
template<class FormatT >
void setDepthInput (const Attachment< FormatT > &d)
 Sets depth attachment which has been already filled by previous render passes, to be read by this render pass. The data is read-only. More...
 
template<class FormatT >
void addColorAndResolveOutput (const Attachment< FormatT > &dc, const Attachment< FormatT > &dr, const typename FormatT::init_type &initValue)
 
void addPreservedOutput (const BaseAttachment &d)
 
template<class FormatT >
void addInput (const Attachment< FormatT > &d, VkImageLayout nodeImageLayout=VK_IMAGE_LAYOUT_GENERAL, bool bAddDependency=true)
 Adds input attachment to be read by this process. More...
 
void addDependency (const Process &targetProcess, const VkSubpassDependency &dependency)
 Adds a dependency arc from current process to specified process. More...
 

Detailed Description

Represents process graph node.

This node performs actual rendering. Internally it constructs a Vulkan subpass.

Each Process node is associated with additional objects of several kinds, in order to specify how and what to render.

Constructor & Destructor Documentation

◆ Process() [1/3]

vpp::Process::Process ( )

Constructs process node for currently defined graph.

Place a Process node in your render graph class (derived from RenderGraph). Do not specify any arguments to the constructor. This is the recommended method of adding nodes. The constructor will automatically determine currently constructed graph instance.

◆ Process() [2/3]

vpp::Process::Process ( RenderGraph pGraph)

Constructs process node for specified graph.

Process nodes can also be defined outside RenderGraph class. In such case, specify parent graph to the constructor explicitly.

◆ Process() [3/3]

vpp::Process::Process ( RenderGraph pGraph,
std::uint32_t  index 
)

Constructs process node for specified graph.

This constructor allows to specify both target render graph and process index. This is usually not needed, as the graph assigns indices automatically. Use only if you know what you are doing.

Member Function Documentation

◆ addColorOutput() [1/3]

template<class FormatT >
void vpp::Process::addColorOutput ( const Attachment< FormatT > &  d,
const typename FormatT::init_type &  initValue,
VkImageLayout  destLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 
)

Adds color output attachment to be produced from scratch. Any previous content of the attachment is destroyed.

The second argument (mandatory) is initial value of the color. The value type depends on the format. For RGBA formats it is a structure of four float numbers, e.g. { 0.0f, 0.0f, 0.0f, 1.0f }. For single component formats it is just a number.

The third optional argument specifies in which layout the attachment should be saved to be used by subsequent render passes. If you want to continue using it as attachment, leave default value. If you want to use it as a texture, change it to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. To transfer the image to different location, use VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL. Note that this argument is applicable for reusing the attachment in completely different render pass - not an input node in current pass. For the latter usage you do not need to specify layout explicitly, as Vulkan will do necessary layout conversion automatically.

◆ addColorOutput() [2/3]

void vpp::Process::addColorOutput ( const Display d)

Adds color output attachment for display image.

This variant initializes the display with black color.

◆ addColorOutput() [3/3]

void vpp::Process::addColorOutput ( const Display d,
const VkClearColorValue &  color 
)

Adds color output attachment for display image.

This variant initializes the display with specified color.

You can use vpp::clearColor() function to easily obtain a value of VkClearColorValue type.

◆ addDependency()

void vpp::Process::addDependency ( const Process targetProcess,
const VkSubpassDependency &  dependency 
)

Adds a dependency arc from current process to specified process.

Note that srcSubpass and dstSubpass members of provided VkSubpassDependency structure are ignored. The indices are taken from source and target processes. You can just assign zero for these members.

◆ addInput()

template<class FormatT >
void vpp::Process::addInput ( const Attachment< FormatT > &  d,
VkImageLayout  nodeImageLayout = VK_IMAGE_LAYOUT_GENERAL,
bool  bAddDependency = true 
)

Adds input attachment to be read by this process.

The attachment should be filled by another Process node inside current render graph. In that process, the attachment may perform a role of color or depth output attachment.

This method is used to pass partial results inside single render graph, as opposed to methods like setDepthInput() or addReusedColorOutput() which are meant for usage with multiple render passes.

The first argument is the attachment node reference.

The second argument is the current layout of the attachment. It may be one of the following layouts:

  • VK_IMAGE_LAYOUT_GENERAL (default),
  • VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL,
  • VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.

See chapter 13.1.11 of the official Vulkan specification for details.

The third argument specifies whether VPP should automatically add a dependency. The dependency is always required for input attachment. By default, VPP adds a dependency from ATTACHMENT_WRITE to SHADER_READ stage with by-region mode enabled. If you want to configure the dependency manually, pass false value here and use addDependency method to add the dependency from the producer process to this process. Otherwise just leave the default true value.

◆ addReusedColorOutput()

template<class FormatT >
void vpp::Process::addReusedColorOutput ( const Attachment< FormatT > &  d,
VkImageLayout  destLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 
)

Adds color output attachment which has been already filled by previous render passes, to be modified by this render pass.

Note that we mean previous render passes here, not previous Process nodes in current render graph. Use this method in multipass rendering engines, where several render graphs are defined and results are subsequently reused.

The second optional argument specifies in which layout the attachment should be saved to be used by subsequent render passes.

◆ index()

std::uint32_t vpp::Process::index ( ) const

Retrieves the index of the Process node.

Returned index is equal to Vulkan index of the subpass, as Process node is actually a wrapper over a subpass.

◆ setDepthInput()

template<class FormatT >
void vpp::Process::setDepthInput ( const Attachment< FormatT > &  d)

Sets depth attachment which has been already filled by previous render passes, to be read by this render pass. The data is read-only.

Note that we mean previous render passes here, not previous Process nodes in current render graph. Use this method in multipass rendering engines, where several render graphs are defined and results are subsequently reused. Typical example is separate D-pass, where depth information is collected first, and then used to optimize proper rendering of the scene. This method is applicable for the final pass, where depth is not modified any more.

◆ setDepthOutput()

template<class FormatT >
void vpp::Process::setDepthOutput ( const Attachment< FormatT > &  d,
const typename FormatT::init_type &  initValue,
VkImageLayout  preserveInLayout = VK_IMAGE_LAYOUT_UNDEFINED 
)

Sets depth attachment to be produced from scratch. Any previous content of the attachment is destroyed.

The second argument (mandatory) is initial value of the depth. The value type depends on the format, but usually it is just float. Specify 1.0f value in typical case, where minimum depth pixel (nearest to the observer) is wanted as a result.

The third argument (optional) specifies whether the depth attachment should be preserved for use in more render passes. By default, the attachment is discarded after this pass. If you want to preserve it, specify in which layout it should be saved.

◆ setReusedDepthOutput()

template<class FormatT >
void vpp::Process::setReusedDepthOutput ( const Attachment< FormatT > &  d,
VkImageLayout  preserveInLayout = VK_IMAGE_LAYOUT_UNDEFINED 
)

Sets depth attachment which has been already filled by previous render passes, to be modified by this render pass.

Note that we mean previous render passes here, not previous Process nodes in current render graph. Use this method in multipass rendering engines, where several render graphs are defined and results are subsequently reused. Typical example is separate D-pass, where depth information is collected first, and then used to optimize proper rendering of the scene. This method allows additional modification of the depth.

The second optional argument specifies whether the depth attachment should be preserved for use in more render passes. By default, the attachment is discarded after this pass. If you want to preserve it, specify in which layout it should be saved.


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