![]() |
Qt 6.x
The Qt SDK
|
#include <qrhivulkan_p.h>
Classes | |
struct | Command |
Public Types | |
enum | PassType { NoPass , RenderPass , ComputePass } |
![]() | |
enum | IndexFormat { IndexUInt16 , IndexUInt32 } |
Specifies the index data type. More... | |
enum | BeginPassFlag { ExternalContent = 0x01 , DoNotTrackResourcesForCompute = 0x02 } |
Flag values for QRhi::beginPass() More... | |
using | DynamicOffset = QPair< int, quint32 > |
Synonym for QPair<int, quint32>. | |
using | VertexInput = QPair< QRhiBuffer *, quint32 > |
Synonym for QPair<QRhiBuffer *, quint32>. | |
![]() | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer } |
Specifies type of the resource. More... | |
Public Member Functions | |
QVkCommandBuffer (QRhiImplementation *rhi) | |
~QVkCommandBuffer () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
const QRhiNativeHandles * | nativeHandles () |
void | resetState () |
void | resetCachedState () |
void | resetCommands () |
void | resetPools () |
![]() | |
QRhiResource::Type | resourceType () const override |
void | resourceUpdate (QRhiResourceUpdateBatch *resourceUpdates) |
Sometimes committing resource updates is necessary or just more convenient without starting a render pass. | |
void | beginPass (QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={}) |
Records starting a new render pass targeting the render target rt. | |
void | endPass (QRhiResourceUpdateBatch *resourceUpdates=nullptr) |
Records ending the current render pass. | |
void | setGraphicsPipeline (QRhiGraphicsPipeline *ps) |
Records setting a new graphics pipeline ps. | |
void | setShaderResources (QRhiShaderResourceBindings *srb=nullptr, int dynamicOffsetCount=0, const DynamicOffset *dynamicOffsets=nullptr) |
Records binding a set of shader resources, such as, uniform buffers or textures, that are made visible to one or more shader stages. | |
void | setVertexInput (int startBinding, int bindingCount, const VertexInput *bindings, QRhiBuffer *indexBuf=nullptr, quint32 indexOffset=0, IndexFormat indexFormat=IndexUInt16) |
Records vertex input bindings. | |
void | setViewport (const QRhiViewport &viewport) |
Records setting the active viewport rectangle specified in viewport. | |
void | setScissor (const QRhiScissor &scissor) |
Records setting the active scissor rectangle specified in scissor. | |
void | setBlendConstants (const QColor &c) |
Records setting the active blend constants to c. | |
void | setStencilRef (quint32 refValue) |
Records setting the active stencil reference value to refValue. | |
void | draw (quint32 vertexCount, quint32 instanceCount=1, quint32 firstVertex=0, quint32 firstInstance=0) |
Records a non-indexed draw. | |
void | drawIndexed (quint32 indexCount, quint32 instanceCount=1, quint32 firstIndex=0, qint32 vertexOffset=0, quint32 firstInstance=0) |
Records an indexed draw. | |
void | debugMarkBegin (const QByteArray &name) |
Records a named debug group on the command buffer with the specified name. | |
void | debugMarkEnd () |
Records the end of a debug group. | |
void | debugMarkMsg (const QByteArray &msg) |
Inserts a debug message msg into the command stream. | |
void | beginComputePass (QRhiResourceUpdateBatch *resourceUpdates=nullptr, BeginPassFlags flags={}) |
Records starting a new compute pass. | |
void | endComputePass (QRhiResourceUpdateBatch *resourceUpdates=nullptr) |
Records ending the current compute pass. | |
void | setComputePipeline (QRhiComputePipeline *ps) |
Records setting a new compute pipeline ps. | |
void | dispatch (int x, int y, int z) |
Records dispatching compute work items, with x, y, and z specifying the number of local workgroups in the corresponding dimension. | |
const QRhiNativeHandles * | nativeHandles () |
void | beginExternal () |
To be called when the application before the application is about to enqueue commands to the current pass' command buffer by calling graphics API functions directly. | |
void | endExternal () |
To be called once the externally added commands are recorded to the command buffer or context. | |
double | lastCompletedGpuTime () |
![]() | |
virtual | ~QRhiResource () |
Destructor. | |
virtual Type | resourceType () const =0 |
virtual void | destroy ()=0 |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
void | deleteLater () |
When called without a frame being recorded, this function is equivalent to deleting the object. | |
QByteArray | name () const |
void | setName (const QByteArray &name) |
Sets a name for the object. | |
quint64 | globalResourceId () const |
QRhi * | rhi () const |
Static Public Attributes | |
static const int | VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32 |
Friends | |
class | QRhiVulkan |
Additional Inherited Members | |
![]() | |
QRhiCommandBuffer (QRhiImplementation *rhi) | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Definition at line 304 of file qrhivulkan_p.h.
Enumerator | |
---|---|
NoPass | |
RenderPass | |
ComputePass |
Definition at line 315 of file qrhivulkan_p.h.
QVkCommandBuffer::QVkCommandBuffer | ( | QRhiImplementation * | rhi | ) |
Definition at line 7410 of file qrhivulkan.cpp.
References resetState().
QVkCommandBuffer::~QVkCommandBuffer | ( | ) |
Definition at line 7416 of file qrhivulkan.cpp.
References destroy().
|
overridevirtual |
Releases (or requests deferred releasing of) the underlying native graphics resources.
Safe to call multiple times, subsequent invocations will be a no-op then.
Once destroy() is called, the QRhiResource instance can be reused, by calling create()
again. That will then result in creating new native graphics resources underneath.
The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.
Implements QRhiResource.
Definition at line 7421 of file qrhivulkan.cpp.
Referenced by ~QVkCommandBuffer().
const QRhiNativeHandles * QVkCommandBuffer::nativeHandles | ( | ) |
Definition at line 7426 of file qrhivulkan.cpp.
References activeSecondaryCbStack, cb, QVarLengthArray< T, Prealloc >::isEmpty(), QVarLengthArray< T, Prealloc >::last(), nativeHandlesStruct, NoPass, passUsesSecondaryCb, and recordingPass.
|
inline |
Definition at line 331 of file qrhivulkan_p.h.
References currentComputePipeline, currentComputeSrb, currentDescSetSlot, currentGraphicsPipeline, currentGraphicsSrb, currentIndexBuffer, currentIndexFormat, currentIndexOffset, currentPipelineGeneration, currentSrbGeneration, currentVertexBuffers, currentVertexOffsets, and inExternal.
Referenced by QRhiVulkan::beginComputePass(), QRhiVulkan::beginPass(), QRhiVulkan::endExternal(), and resetState().
|
inline |
Definition at line 534 of file qrhivulkan_p.h.
References QVarLengthArray< T, Prealloc >::clear(), currentPassResTrackerIndex, passResTrackers, and resetPools().
Referenced by QRhiVulkan::beginExternal(), QRhiVulkan::finish(), and resetState().
|
inline |
Definition at line 542 of file qrhivulkan_p.h.
References pools.
Referenced by resetCommands().
|
inline |
Definition at line 321 of file qrhivulkan_p.h.
References activeSecondaryCbStack, QVarLengthArray< T, Prealloc >::clear(), currentTarget, lastGpuTime, NoPass, passUsesSecondaryCb, recordingPass, resetCachedState(), and resetCommands().
Referenced by QVkCommandBuffer().
|
friend |
Definition at line 564 of file qrhivulkan_p.h.
QVarLengthArray<VkCommandBuffer, 4> QVkCommandBuffer::activeSecondaryCbStack |
Definition at line 364 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginComputePass(), QRhiVulkan::beginExternal(), QRhiVulkan::beginPass(), QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkEnd(), QRhiVulkan::debugMarkMsg(), QRhiVulkan::dispatch(), QRhiVulkan::draw(), QRhiVulkan::drawIndexed(), QRhiVulkan::endComputePass(), QRhiVulkan::endExternal(), QRhiVulkan::endPass(), nativeHandles(), resetState(), QRhiVulkan::setBlendConstants(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), QRhiVulkan::setScissor(), QRhiVulkan::setShaderResources(), QRhiVulkan::setStencilRef(), QRhiVulkan::setVertexInput(), and QRhiVulkan::setViewport().
QVarLengthArray<VkBufferMemoryBarrier, 8> QVkCommandBuffer::bufferBarrier |
Definition at line 561 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::dispatch(), QRhiVulkan::recordPrimaryCommandBuffer(), and QRhiVulkan::trackedBufferBarrier().
QVarLengthArray<VkBufferImageCopy, 16> QVkCommandBuffer::bufferImageCopy |
Definition at line 555 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::enqueueResourceUpdates(), and QRhiVulkan::recordPrimaryCommandBuffer().
VkCommandBuffer QVkCommandBuffer::cb = VK_NULL_HANDLE |
Definition at line 312 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginFrame(), QRhiVulkan::beginOffscreenFrame(), QRhiVulkan::destroy(), QRhiVulkan::endOffscreenFrame(), QRhiVulkan::finish(), nativeHandles(), QRhiVulkan::recordPrimaryCommandBuffer(), and QRhiVulkan::recordTransitionPassResources().
QVarLengthArray<VkClearValue, 4> QVkCommandBuffer::clearValue |
Definition at line 554 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginPass(), and QRhiVulkan::recordPrimaryCommandBuffer().
QRhiBackendCommandList<Command> QVkCommandBuffer::commands |
Definition at line 530 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginPass(), QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkEnd(), QRhiVulkan::debugMarkMsg(), QRhiVulkan::depthStencilExplicitBarrier(), QRhiVulkan::dispatch(), QRhiVulkan::draw(), QRhiVulkan::drawIndexed(), QRhiVulkan::endAndEnqueueSecondaryCommandBuffer(), QRhiVulkan::endExternal(), QRhiVulkan::endPass(), QRhiVulkan::enqueueResourceUpdates(), QRhiVulkan::enqueueTransitionPassResources(), QRhiVulkan::recordPrimaryCommandBuffer(), QRhiVulkan::setBlendConstants(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), QRhiVulkan::setScissor(), QRhiVulkan::setShaderResources(), QRhiVulkan::setStencilRef(), QRhiVulkan::setVertexInput(), QRhiVulkan::setViewport(), QRhiVulkan::subresourceBarrier(), QRhiVulkan::trackedBufferBarrier(), and QRhiVulkan::trackedImageBarrier().
struct { ... } QVkCommandBuffer::computePassState |
Referenced by QRhiVulkan::beginComputePass(), and QRhiVulkan::dispatch().
QRhiComputePipeline* QVkCommandBuffer::currentComputePipeline |
Definition at line 352 of file qrhivulkan_p.h.
Referenced by resetCachedState(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), and QRhiVulkan::setShaderResources().
QRhiShaderResourceBindings* QVkCommandBuffer::currentComputeSrb |
Definition at line 355 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::dispatch(), resetCachedState(), and QRhiVulkan::setShaderResources().
int QVkCommandBuffer::currentDescSetSlot |
Definition at line 357 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setShaderResources().
QRhiGraphicsPipeline* QVkCommandBuffer::currentGraphicsPipeline |
Definition at line 351 of file qrhivulkan_p.h.
Referenced by resetCachedState(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), QRhiVulkan::setScissor(), QRhiVulkan::setShaderResources(), and QRhiVulkan::setViewport().
QRhiShaderResourceBindings* QVkCommandBuffer::currentGraphicsSrb |
Definition at line 354 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setShaderResources().
VkBuffer QVkCommandBuffer::currentIndexBuffer |
Definition at line 358 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setVertexInput().
VkIndexType QVkCommandBuffer::currentIndexFormat |
Definition at line 360 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setVertexInput().
quint32 QVkCommandBuffer::currentIndexOffset |
Definition at line 359 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setVertexInput().
int QVkCommandBuffer::currentPassResTrackerIndex |
Definition at line 532 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), QRhiVulkan::endExternal(), QRhiVulkan::enqueueTransitionPassResources(), resetCommands(), QRhiVulkan::setShaderResources(), and QRhiVulkan::setVertexInput().
uint QVkCommandBuffer::currentPipelineGeneration |
Definition at line 353 of file qrhivulkan_p.h.
Referenced by resetCachedState(), QRhiVulkan::setComputePipeline(), and QRhiVulkan::setGraphicsPipeline().
uint QVkCommandBuffer::currentSrbGeneration |
Definition at line 356 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setShaderResources().
QRhiRenderTarget* QVkCommandBuffer::currentTarget |
Definition at line 350 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginPass(), QRhiVulkan::endPass(), maybeRenderTargetData(), resetState(), QRhiVulkan::setScissor(), and QRhiVulkan::setViewport().
VkBuffer QVkCommandBuffer::currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT] |
Definition at line 362 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setVertexInput().
quint32 QVkCommandBuffer::currentVertexOffsets[VERTEX_INPUT_RESOURCE_SLOT_COUNT] |
Definition at line 363 of file qrhivulkan_p.h.
Referenced by resetCachedState(), and QRhiVulkan::setVertexInput().
QVarLengthArray<QByteArray, 4> QVkCommandBuffer::debugMarkerData |
Definition at line 559 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkMsg(), and QRhiVulkan::recordPrimaryCommandBuffer().
QVarLengthArray<uint32_t, 4> QVkCommandBuffer::dynamicOffset |
Definition at line 556 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::recordPrimaryCommandBuffer(), and QRhiVulkan::setShaderResources().
QVarLengthArray<VkImageMemoryBarrier, 8> QVkCommandBuffer::imageBarrier |
Definition at line 560 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::depthStencilExplicitBarrier(), QRhiVulkan::dispatch(), QRhiVulkan::recordPrimaryCommandBuffer(), QRhiVulkan::subresourceBarrier(), and QRhiVulkan::trackedImageBarrier().
bool QVkCommandBuffer::inExternal |
Definition at line 365 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginExternal(), QRhiVulkan::endExternal(), and resetCachedState().
double QVkCommandBuffer::lastGpuTime = 0 |
Definition at line 349 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginFrame(), QRhiVulkan::endOffscreenFrame(), QRhiVulkan::lastCompletedGpuTime(), and resetState().
QRhiVulkanCommandBufferNativeHandles QVkCommandBuffer::nativeHandlesStruct |
Definition at line 313 of file qrhivulkan_p.h.
Referenced by nativeHandles().
QVarLengthArray<QRhiPassResourceTracker, 8> QVkCommandBuffer::passResTrackers |
Definition at line 531 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), QRhiVulkan::enqueueTransitionPassResources(), QRhiVulkan::recordPrimaryCommandBuffer(), resetCommands(), QRhiVulkan::setShaderResources(), and QRhiVulkan::setVertexInput().
bool QVkCommandBuffer::passUsesSecondaryCb |
Definition at line 348 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginComputePass(), QRhiVulkan::beginExternal(), QRhiVulkan::beginPass(), QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkEnd(), QRhiVulkan::debugMarkMsg(), QRhiVulkan::dispatch(), QRhiVulkan::draw(), QRhiVulkan::drawIndexed(), QRhiVulkan::endComputePass(), QRhiVulkan::endPass(), nativeHandles(), resetState(), QRhiVulkan::setBlendConstants(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), QRhiVulkan::setScissor(), QRhiVulkan::setShaderResources(), QRhiVulkan::setStencilRef(), QRhiVulkan::setVertexInput(), and QRhiVulkan::setViewport().
struct { ... } QVkCommandBuffer::pools |
Referenced by QRhiVulkan::beginPass(), QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkMsg(), QRhiVulkan::depthStencilExplicitBarrier(), QRhiVulkan::dispatch(), QRhiVulkan::enqueueResourceUpdates(), QRhiVulkan::recordPrimaryCommandBuffer(), resetPools(), QRhiVulkan::setShaderResources(), QRhiVulkan::setVertexInput(), QRhiVulkan::subresourceBarrier(), QRhiVulkan::trackedBufferBarrier(), and QRhiVulkan::trackedImageBarrier().
PassType QVkCommandBuffer::recordingPass |
Definition at line 347 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::beginComputePass(), QRhiVulkan::beginExternal(), QRhiVulkan::beginPass(), QRhiVulkan::debugMarkBegin(), QRhiVulkan::debugMarkEnd(), QRhiVulkan::debugMarkMsg(), QRhiVulkan::depthStencilExplicitBarrier(), QRhiVulkan::dispatch(), QRhiVulkan::draw(), QRhiVulkan::drawIndexed(), QRhiVulkan::endComputePass(), QRhiVulkan::endExternal(), QRhiVulkan::endPass(), QRhiVulkan::finish(), maybeRenderTargetData(), nativeHandles(), QRhiVulkan::recordPrimaryCommandBuffer(), resetState(), QRhiVulkan::resourceUpdate(), QRhiVulkan::setBlendConstants(), QRhiVulkan::setComputePipeline(), QRhiVulkan::setGraphicsPipeline(), QRhiVulkan::setScissor(), QRhiVulkan::setShaderResources(), QRhiVulkan::setStencilRef(), QRhiVulkan::setVertexInput(), QRhiVulkan::setViewport(), QRhiVulkan::subresourceBarrier(), QRhiVulkan::trackedBufferBarrier(), and QRhiVulkan::trackedImageBarrier().
|
static |
Definition at line 361 of file qrhivulkan_p.h.
QVarLengthArray<VkBuffer, 4> QVkCommandBuffer::vertexBuffer |
Definition at line 557 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::recordPrimaryCommandBuffer(), and QRhiVulkan::setVertexInput().
QVarLengthArray<VkDeviceSize, 4> QVkCommandBuffer::vertexBufferOffset |
Definition at line 558 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::recordPrimaryCommandBuffer(), and QRhiVulkan::setVertexInput().
QHash<QRhiResource *, QPair<VkAccessFlags, bool> > QVkCommandBuffer::writtenResources |
Definition at line 368 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::dispatch().