QRhiIndirectCommandBufferBuildInfo Struct

Describes how to build an indirect command buffer from a QRhiBuffer. More...

Header: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
Since: Qt 6.13

Public Variables

quint32 commandCount
QRhiBuffer *countBuffer
quint32 countBufferOffset
QRhiBuffer *indexBuffer
quint32 indexBufferOffset
QRhiCommandBuffer::IndexFormat indexFormat
QRhiBuffer *sourceBuffer
quint32 sourceBufferOffset
quint32 stride
QRhiGraphicsPipeline::Topology topology

Detailed Description

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

See also QRhiCommandBuffer::buildIndirect().

Member Variable Documentation

quint32 QRhiIndirectCommandBufferBuildInfo::commandCount

The number of commands to take from sourceBuffer. This is what QRhiIndirectCommandBuffer::commandCount() reports afterwards, and so how many draws QRhiCommandBuffer::executeIndirect() issues by default.

0 means QRhiIndirectCommandBuffer::maxCommandCount(). It does not mean "as many as fit in sourceBuffer": a buffer written by the GPU can be larger than the number of commands in it, so no count is ever derived from its size. A value above QRhiIndirectCommandBuffer::maxCommandCount() is clamped to it, with a warning.

Note: Specifying countBuffer changes what this value means: it stops being the number of commands and becomes the maximum number of commands, with the device-side count in countBuffer deciding the actual number. Without a countBuffer, exactly this many commands are executed.

QRhiBuffer *QRhiIndirectCommandBufferBuildInfo::countBuffer

An optional buffer whose first quint32 holds the number of commands to execute. Requires QRhi::DrawIndirectCount.

Note: Setting this turns commandCount into an upper bound. The device-side value is clamped to it, so a count buffer can only ever reduce the number of draws, never raise it.

quint32 QRhiIndirectCommandBufferBuildInfo::countBufferOffset

QRhiBuffer *QRhiIndirectCommandBufferBuildInfo::indexBuffer

The index buffer the commands index into. Required for IndexedDraws.

quint32 QRhiIndirectCommandBufferBuildInfo::indexBufferOffset

QRhiCommandBuffer::IndexFormat QRhiIndirectCommandBufferBuildInfo::indexFormat

QRhiBuffer *QRhiIndirectCommandBufferBuildInfo::sourceBuffer

The buffer holding the QRhiIndirectDrawCommand or QRhiIndexedIndirectDrawCommand entries. Must have IndirectBuffer usage.

Its size is not used to work out how many commands there are, see commandCount.

quint32 QRhiIndirectCommandBufferBuildInfo::sourceBufferOffset

quint32 QRhiIndirectCommandBufferBuildInfo::stride

The byte distance between two commands in sourceBuffer. 0 means the size of the corresponding command struct.

QRhiGraphicsPipeline::Topology QRhiIndirectCommandBufferBuildInfo::topology

The topology the commands will be drawn with. Must match the topology of the graphics pipeline that is set when QRhiCommandBuffer::executeIndirect() is called. Some backends need it in order to build their native indirect command buffer, and it is not available to them outside of a render pass.