QRhiVertexInputLayout Class

Describes the layout of vertex inputs consumed by a vertex shader. More...

Header: #include <QRhiVertexInputLayout>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 6.6

Public Functions

QRhiVertexInputLayout()
const QRhiVertexInputAttribute *attributeAt(qsizetype index) const
qsizetype attributeCount() const
const QRhiVertexInputBinding *bindingAt(qsizetype index) const
qsizetype bindingCount() const
const QRhiVertexInputAttribute *cbeginAttributes() const
const QRhiVertexInputBinding *cbeginBindings() const
const QRhiVertexInputAttribute *cendAttributes() const
const QRhiVertexInputBinding *cendBindings() const
void setAttributes(std::initializer_list<QRhiVertexInputAttribute> list)
void setAttributes(InputIterator first, InputIterator last)
void setBindings(std::initializer_list<QRhiVertexInputBinding> list)
void setBindings(InputIterator first, InputIterator last)
size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0)
bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)
bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)

Detailed Description

The vertex input layout is defined by the collections of QRhiVertexInputBinding and QRhiVertexInputAttribute.

As an example, let's assume that we have a single buffer with 3 component vertex positions and 2 component UV coordinates interleaved (x, y, z, u, v), that the position and UV are expected at input locations 0 and 1 by the vertex shader, and that the vertex buffer will be bound at binding point 0 using setVertexInput() later on:

 QRhiVertexInputLayout inputLayout;
 inputLayout.setBindings({
     { 5 * sizeof(float) }
 });
 inputLayout.setAttributes({
     { 0, 0, QRhiVertexInputAttribute::Float3, 0 },
     { 0, 1, QRhiVertexInputAttribute::Float2, 3 * sizeof(float) }
 });

Note: This is a RHI API with limited compatibility guarantees, see QRhi for details.

Member Function Documentation

[constexpr noexcept] QRhiVertexInputLayout::QRhiVertexInputLayout()

Constructs an empty vertex input layout description.

const QRhiVertexInputAttribute *QRhiVertexInputLayout::attributeAt(qsizetype index) const

Returns the attribute at the given index.

qsizetype QRhiVertexInputLayout::attributeCount() const

Returns the number of attributes.

const QRhiVertexInputBinding *QRhiVertexInputLayout::bindingAt(qsizetype index) const

Returns the binding at the given index.

qsizetype QRhiVertexInputLayout::bindingCount() const

Returns the number of bindings.

const QRhiVertexInputAttribute *QRhiVertexInputLayout::cbeginAttributes() const

Returns a const iterator pointing to the first item in the attribute list.

const QRhiVertexInputBinding *QRhiVertexInputLayout::cbeginBindings() const

Returns a const iterator pointing to the first item in the binding list.

const QRhiVertexInputAttribute *QRhiVertexInputLayout::cendAttributes() const

Returns a const iterator pointing just after the last item in the attribute list.

const QRhiVertexInputBinding *QRhiVertexInputLayout::cendBindings() const

Returns a const iterator pointing just after the last item in the binding list.

void QRhiVertexInputLayout::setAttributes(std::initializer_list<QRhiVertexInputAttribute> list)

Sets the attributes from the specified list.

template <typename InputIterator> void QRhiVertexInputLayout::setAttributes(InputIterator first, InputIterator last)

Sets the attributes using the iterators first and last.

void QRhiVertexInputLayout::setBindings(std::initializer_list<QRhiVertexInputBinding> list)

Sets the bindings from the specified list.

template <typename InputIterator> void QRhiVertexInputLayout::setBindings(InputIterator first, InputIterator last)

Sets the bindings using the iterators first and last.

Related Non-Members

[noexcept] size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0)

Returns the hash value for v, using seed to seed the calculation.

[noexcept] bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)

Returns false if the values in the two QRhiVertexInputLayout objects a and b are equal; otherwise returns true.

[noexcept] bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)

Returns true if the values in the two QRhiVertexInputLayout objects a and b are equal.