![]() |
VPP
0.8
A high-level modern C++ API for Vulkan
|
Binding point class for vertex and instance input to shaders. Place in your pipeline configuration class to declare a vertex or instance data source. More...
#include <vppLangIntVertex.hpp>
Public Member Functions | |
auto | operator= (const VertexBufferView &hVertexBufferView) |
CPU-side binding operator. Use to bind actual data buffer to the binding point. More... | |
template<typename MemberT > | |
auto | operator[] (MemberT YourDefinition::*pMember) const |
GPU-side access operator. Use to read a field (Attribute) in the shader. More... | |
Binding point class for vertex and instance input to shaders. Place in your pipeline configuration class to declare a vertex or instance data source.
Specify the name of your vertex or instance data structure template as the argument. Accepts templates derived both from VertexStruct and InstanceStruct.
This class should be used only to define a binding point inside your custom pipeline configuration (a PipelineConfig subclass).
Vertex and instance data has exactly the same syntax, except for the structure definition (VertexStruct vs InstanceStruct).
An example:
auto vpp::inVertexData< TDef >::operator= | ( | const VertexBufferView & | hVertexBufferView | ) |
CPU-side binding operator. Use to bind actual data buffer to the binding point.
This operator returns a value that must be passed to cmdBindVertexInput method of PipelineConfig class. You can also make a list of more assignments, joining them with comma operator. The cmdBindVertexInput method accepts such a list.
The cmdBindVertexInput and cmdBindIndexInput are meant to be used mainly inside the rendering sequence within render graph (lambda function supplied to the Process object). They generate Vulkan commands into default command buffer. Actual binding of the vertex and instance data occurs at command execution time.
The example below also shows how to bind index data for indexed draws. It is very similar to vertex data, but indices do not need to have explicitly defined binding point. The binding point for indices is implicitly provided by each PipelineConfig instance.
Example:
Another example for multiple vertex buffers:
auto vpp::inVertexData< TDef >::operator[] | ( | MemberT YourDefinition::* | pMember | ) | const |
GPU-side access operator. Use to read a field (Attribute) in the shader.
Supply a member pointer to the attribute (inside GPU level version of the structure) which you wish to read.
This operator returns a R-value of appropriate GPU-side type, corresponding to the format of the attribute.
Example: