![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | Format { Float4 , Float3 , Float2 , Float , UNormByte4 , UNormByte2 , UNormByte , UInt4 , UInt3 , UInt2 , UInt , SInt4 , SInt3 , SInt2 , SInt , Half4 , Half3 , Half2 , Half } |
Specifies the type of the element data. More... | |
Public Member Functions | |
QRhiVertexInputAttribute ()=default | |
Constructs a default vertex input attribute description. | |
QRhiVertexInputAttribute (int binding, int location, Format format, quint32 offset, int matrixSlice=-1) | |
Constructs a vertex input attribute description with the specified binding number, location, format, and offset. | |
int | binding () const |
void | setBinding (int b) |
Sets the binding point index to b. | |
int | location () const |
void | setLocation (int loc) |
Sets the location of the vertex input element to loc. | |
Format | format () const |
void | setFormat (Format f) |
Sets the format of the vertex input element to f. | |
quint32 | offset () const |
void | setOffset (quint32 ofs) |
Sets the byte offset for the input element to ofs. | |
int | matrixSlice () const |
void | setMatrixSlice (int slice) |
Sets the matrix slice. | |
Friends | |
bool | operator== (const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept |
bool | operator!= (const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) noexcept |
size_t | qHash (const QRhiVertexInputAttribute &v, size_t seed=0) noexcept |
\inmodule QtGui
Describes a single vertex input element.
The members specify the binding number, location, format, and offset for a single vertex input element.
{TEXCOORD<location>} as the semantic for each input. Hence no separate semantic name and index.As an example, assume a vertex shader with the following inputs:
\badcode layout(location = 0) in vec4 position; layout(location = 1) in vec2 texcoord;
Now let's assume that we have 3 component vertex positions {(x, y, z)} and 2 component texture coordinates
{(u, v)} are provided in a non-interleaved format in a buffer (or separate buffers even). Once two bindings are defined, the attributes could be specified as:
Once a graphics pipeline with this vertex input layout is bound, the vertex inputs could be set up like the following for drawing a cube with 36 vertices, assuming we have a single buffer with first the positions and then the texture coordinates:
When working with interleaved data, there will typically be just one binding, with multiple attributes referring to that same buffer binding point:
and then:
Specifies the type of the element data.
\value Float4 Four component float vector \value Float3 Three component float vector \value Float2 Two component float vector \value Float Float \value UNormByte4 Four component normalized unsigned byte vector \value UNormByte2 Two component normalized unsigned byte vector \value UNormByte Normalized unsigned byte \value UInt4 Four component unsigned integer vector \value UInt3 Three component unsigned integer vector \value UInt2 Two component unsigned integer vector \value UInt Unsigned integer \value SInt4 Four component signed integer vector \value SInt3 Three component signed integer vector \value SInt2 Two component signed integer vector \value SInt Signed integer \value Half4 Four component half precision (16 bit) float vector \value Half3 Three component half precision (16 bit) float vector \value Half2 Two component half precision (16 bit) float vector \value Half Half precision (16 bit) float
Enumerator | |
---|---|
Float4 | |
Float3 | |
Float2 | |
Float | |
UNormByte4 | |
UNormByte2 | |
UNormByte | |
UInt4 | |
UInt3 | |
UInt2 | |
UInt | |
SInt4 | |
SInt3 | |
SInt2 | |
SInt | |
Half4 | |
Half3 | |
Half2 | |
Half |
|
default |
Constructs a default vertex input attribute description.
QRhiVertexInputAttribute::QRhiVertexInputAttribute | ( | int | binding, |
int | location, | ||
Format | format, | ||
quint32 | offset, | ||
int | matrixSlice = -1 |
||
) |
Constructs a vertex input attribute description with the specified binding number, location, format, and offset.
matrixSlice should be -1 except when this attribute corresponds to a row or column of a matrix (for example, a 4x4 matrix becomes 4 vec4s, consuming 4 consecutive vertex input locations), in which case it is the index of the row or column. {location - matrixSlice} must always be equal to the
location
for the first row or column of the unrolled matrix.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the matrix slice.
By default this is set to -1, and should be set to a >= 0 value only when this attribute corresponds to a row or column of a matrix (for example, a 4x4 matrix becomes 4 vec4s, consuming 4 consecutive vertex input locations), in which case it is the index of the row or column. {location - matrixSlice} must always be equal to the
location
for the first row or column of the unrolled matrix.
|
friend |
false
if the values in the two QRhiVertexInputAttribute objects a and b are equal; otherwise returns true
.
|
friend |
true
if the values in the two QRhiVertexInputAttribute objects a and b are equal.
|
friend |