![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
Output attachment binding point. More...
#include <vppLangIntImages.hpp>
Public Member Functions | |
outAttachment (const Attachment< FormatT > &attachmentNode) | |
Creates the binding point. More... | |
outAttachment (const Display &attachmentNode) | |
Creates the binding point. More... | |
void | operator= (const rvalue_type &value) |
Writes output color value to the attachment. More... | |
void | assign (const rvalue_type &value, int index=0) |
Writes output color value to the attachment. More... | |
Public Attributes | |
typedef< implementation_defined > | rvalue_type |
The type of the pixel color value. More... | |
Output attachment binding point.
This is the primary means to generate images in fragment shaders.
Each outAttachment
binding point is associated with corresponding node in render graph. You must provide a reference to that node in the constructor. Both Display and Attachment nodes are accepted.
You also do not bind an image view to the output attachment (as with other binding points). Instead, images are bound to Attachment and Display nodes in the render graph. This binding occurs either directly (providing surface or image view reference to the attachment constructor), or indirectly, through explicit FrameBuffer object. The simplest method is to use the constructor.
The template argument should be a typedef to vpp::format
template instance. It should be exactly the same format as used for the Attachment node. For display nodes use FormatF32x4
format as defined in the example below (assume RGBA order).
An example:
This binding point can not be used in any image functions. Use assignment operator to write the pixel value to it.
vpp::outAttachment< FormatT >::outAttachment | ( | const Attachment< FormatT > & | attachmentNode | ) |
Creates the binding point.
This constructor applies to regular (memory output) attachments.
Specify the attachment node (from render graph) as the only argument.
vpp::outAttachment< FormatT >::outAttachment | ( | const Display & | attachmentNode | ) |
Creates the binding point.
This constructor applies to display attachments.
Specify the display node (from render graph) as the only argument.
void vpp::outAttachment< FormatT >::assign | ( | const rvalue_type & | value, |
int | index = 0 |
||
) |
Writes output color value to the attachment.
Use this function inside fragment shader code to set resulting color for currently processed pixel. It is equivalent to the assignment operator, however it accepts one additional argument.
The index
argument can have value 0
or 1
and specifies which input of the blending unit the color value will be directed to. See chapter 14.3 of the official Vulkan specification for more detail.
void vpp::outAttachment< FormatT >::operator= | ( | const rvalue_type & | value | ) |
Writes output color value to the attachment.
Use the operator inside fragment shader code to set resulting color for currently processed pixel.
Note that the meaning of the assignment operator is different here than for other binding points.
typedef<implementation_defined> vpp::outAttachment< FormatT >::rvalue_type |
The type of the pixel color value.
This is a typedef indicating the type of the value this attachment expects as output value in the shader. It depends on the image format provided as the template argument. It can be vector or scalar.
The number of vector components corresponds to the format component count. Individual component type can be Float
, Double
, Int
or UInt
depending also on the format. Most formats use Float
type (e.g. float
, vpp::float16_t
, vpp::unorm_t
, vpp::snorm_t
). Formats defined from standard integer or unsigned integer types yield Int
or UInt
shader types. In case of vectors we have e.g. Vec4
for RGBA formats, Vec3
for RGB, etc. (and respectively IVec4
, IVec3
, UVec4
, UVec3
).