![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
Provides input access to communication variable binding point from shader code. More...
#include <vppLangIntInOut.hpp>
Public Member Functions | |
Input (const BindingPointT &var) | |
Constructs the input point associated with specified binding point (ioVariable or ioStructure). | |
Input (const BindingPointT &var, std::uint32_t interpFlags) | |
Constructs the input point associated with specified binding point (ioVariable or ioStructure). Additionally sets interpolation mode. The mode is a bitwise OR of the following flags: More... | |
template<typename MemberT > | |
auto | operator[] (MemberT StructT::*pMember) const |
Provides access to structure members for ioStructure binding points. Provide a pointer to member of your structure (a subclass of LocalStruct). More... | |
auto | operator[] (const Int &index) |
Provides access to an item in case if the variable is an array. More... | |
auto | operator[] (const UInt &index) |
auto | operator[] (int index) |
auto | operator[] (unsigned int index) |
Int | Size () const |
Returns GPU-side value equal to the array size (number of vertices). | |
int | size () const |
Returns CPU-side value equal to the array size (number of vertices). | |
ValueT | InterpolateAtCentroid () |
ValueT | InterpolateAtSample (const Int &sample) |
ValueT | InterpolateAtOffset (const Vec2 &offset) |
Provides input access to communication variable binding point from shader code.
Place Input inside your shader code to read data from a communication variable.
The argument should be decltype of the binding point field. It accepts ioVariable and ioStructure binding points. Also provide the binding point reference to the constructor.
You must pay attention yo use Input only in the shader which has been declared as destination shader in the binding point.
Example of usage:
vpp::Input< BindingPointT >::Input | ( | const BindingPointT & | var, |
std::uint32_t | interpFlags | ||
) |
Constructs the input point associated with specified binding point (ioVariable or ioStructure). Additionally sets interpolation mode. The mode is a bitwise OR of the following flags:
This constructor is allowed only for ioVariable binding points and only in fragment shaders.
auto vpp::Input< BindingPointT >::operator[] | ( | MemberT StructT::* | pMember | ) | const |
Provides access to structure members for ioStructure binding points. Provide a pointer to member of your structure (a subclass of LocalStruct).
Not applicable for ioVariable binding points.
auto vpp::Input< BindingPointT >::operator[] | ( | const Int & | index | ) |
Provides access to an item in case if the variable is an array.
Communication variables are automatically converted to arrays in certain types of shaders, i.e.:
This is because these shaders operate on multiple vertices at once, forming a geometric primitive or patch. You can access values for individual vertices, by using one of indexing operators.
auto vpp::Input< BindingPointT >::operator[] | ( | const UInt & | index | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
auto vpp::Input< BindingPointT >::operator[] | ( | int | index | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
auto vpp::Input< BindingPointT >::operator[] | ( | unsigned int | index | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.