![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | Classification { PerVertex , PerInstance } |
Describes the input data classification. More... | |
Public Member Functions | |
QRhiVertexInputBinding ()=default | |
Constructs a default vertex input binding description. | |
QRhiVertexInputBinding (quint32 stride, Classification cls=PerVertex, quint32 stepRate=1) | |
Constructs a vertex input binding description with the specified stride, classification cls, and instance step rate stepRate. | |
quint32 | stride () const |
void | setStride (quint32 s) |
Sets the stride to s. | |
Classification | classification () const |
void | setClassification (Classification c) |
Sets the input data classification c. | |
quint32 | instanceStepRate () const |
void | setInstanceStepRate (quint32 rate) |
Sets the instance step rate. | |
Friends | |
bool | operator== (const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept |
bool | operator!= (const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) noexcept |
size_t | qHash (const QRhiVertexInputBinding &v, size_t seed=0) noexcept |
\inmodule QtGui
Describes a vertex input binding.
Specifies the stride (in bytes, must be a multiple of 4), the classification and optionally the instance step rate.
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 also that 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). Defining two bindings could then be done like this:
Only the stride is interesting here since instancing is not used. The binding number is given by the index of the QRhiVertexInputBinding element in the bindings vector of the QRhiVertexInputLayout.
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:
Note how the index defined by {startBinding
+ i}, where i
is the index in the second argument of \l{QRhiCommandBuffer::setVertexInput()}{setVertexInput()}, matches the index of the corresponding entry in the bindings
vector of the QRhiVertexInputLayout.
|
default |
Constructs a default vertex input binding description.
QRhiVertexInputBinding::QRhiVertexInputBinding | ( | quint32 | stride, |
Classification | cls = PerVertex , |
||
quint32 | stepRate = 1 |
||
) |
Constructs a vertex input binding description with the specified stride, classification cls, and instance step rate stepRate.
|
inline |
Definition at line 192 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), and QRhiGles2::executeCommandBuffer().
|
inline |
Definition at line 195 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), and QRhiGles2::executeCommandBuffer().
|
inline |
|
inline |
Definition at line 189 of file qrhi.h.
Referenced by QRhiGles2::executeCommandBuffer(), and QRhiD3D11::setVertexInput().
|
friend |
false
if the values in the two QRhiVertexInputBinding objects a and b are equal; otherwise returns true
.
|
friend |
true
if the values in the two QRhiVertexInputBinding objects a and b are equal.
|
friend |