![]() |
Qt 6.x
The Qt SDK
|
#include <qrhimetal_p.h>
Public Member Functions | |
QMetalGraphicsPipeline (QRhiImplementation *rhi) | |
~QMetalGraphicsPipeline () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
bool | create () override |
Creates the corresponding native graphics resources. | |
void | makeActiveForCurrentRenderPassEncoder (QMetalCommandBuffer *cbD) |
void | setupAttachmentsInMetalRenderPassDescriptor (void *metalRpDesc, QMetalRenderPassDescriptor *rpD) |
void | setupMetalDepthStencilDescriptor (void *metalDsDesc) |
void | mapStates () |
bool | createVertexFragmentPipeline () |
bool | createTessellationPipelines (const QShader &tessVert, const QShader &tesc, const QShader &tese, const QShader &tessFrag) |
![]() | |
QRhiResource::Type | resourceType () const override |
Flags | flags () const |
void | setFlags (Flags f) |
Sets the flags f. | |
Topology | topology () const |
void | setTopology (Topology t) |
Sets the primitive topology t. | |
CullMode | cullMode () const |
void | setCullMode (CullMode mode) |
Sets the specified face culling mode. | |
FrontFace | frontFace () const |
void | setFrontFace (FrontFace f) |
Sets the front face mode f. | |
void | setTargetBlends (std::initializer_list< TargetBlend > list) |
Sets the list of render target blend settings. | |
template<typename InputIterator > | |
void | setTargetBlends (InputIterator first, InputIterator last) |
Sets the list of render target blend settings from the iterators first and last. | |
const TargetBlend * | cbeginTargetBlends () const |
const TargetBlend * | cendTargetBlends () const |
const TargetBlend * | targetBlendAt (qsizetype index) const |
qsizetype | targetBlendCount () const |
bool | hasDepthTest () const |
void | setDepthTest (bool enable) |
Enables or disables depth testing based on enable. | |
bool | hasDepthWrite () const |
void | setDepthWrite (bool enable) |
Controls the writing out of depth data into the depth buffer based on enable. | |
CompareOp | depthOp () const |
void | setDepthOp (CompareOp op) |
Sets the depth comparison function op. | |
bool | hasStencilTest () const |
void | setStencilTest (bool enable) |
Enables or disables stencil tests based on enable. | |
StencilOpState | stencilFront () const |
void | setStencilFront (const StencilOpState &state) |
Sets the stencil test state for front faces. | |
StencilOpState | stencilBack () const |
void | setStencilBack (const StencilOpState &state) |
Sets the stencil test state for back faces. | |
quint32 | stencilReadMask () const |
void | setStencilReadMask (quint32 mask) |
Sets the stencil read mask. | |
quint32 | stencilWriteMask () const |
void | setStencilWriteMask (quint32 mask) |
Sets the stencil write mask. | |
int | sampleCount () const |
void | setSampleCount (int s) |
Sets the sample count. | |
float | lineWidth () const |
void | setLineWidth (float width) |
Sets the line width. | |
int | depthBias () const |
void | setDepthBias (int bias) |
Sets the depth bias. | |
float | slopeScaledDepthBias () const |
void | setSlopeScaledDepthBias (float bias) |
Sets the slope scaled depth bias. | |
void | setShaderStages (std::initializer_list< QRhiShaderStage > list) |
Sets the list of shader stages. | |
template<typename InputIterator > | |
void | setShaderStages (InputIterator first, InputIterator last) |
Sets the list of shader stages from the iterators first and last. | |
const QRhiShaderStage * | cbeginShaderStages () const |
const QRhiShaderStage * | cendShaderStages () const |
const QRhiShaderStage * | shaderStageAt (qsizetype index) const |
qsizetype | shaderStageCount () const |
QRhiVertexInputLayout | vertexInputLayout () const |
void | setVertexInputLayout (const QRhiVertexInputLayout &layout) |
Specifies the vertex input layout. | |
QRhiShaderResourceBindings * | shaderResourceBindings () const |
void | setShaderResourceBindings (QRhiShaderResourceBindings *srb) |
Associates with srb describing the resource binding layout and the resources (QRhiBuffer, QRhiTexture) themselves. | |
QRhiRenderPassDescriptor * | renderPassDescriptor () const |
void | setRenderPassDescriptor (QRhiRenderPassDescriptor *desc) |
Associates with the specified QRhiRenderPassDescriptor desc. | |
int | patchControlPointCount () const |
void | setPatchControlPointCount (int count) |
Sets the number of patch control points to count. | |
PolygonMode | polygonMode () const |
void | setPolygonMode (PolygonMode mode) |
Sets the polygon mode. | |
int | multiViewCount () const |
void | setMultiViewCount (int count) |
Sets the view count for multiview rendering. | |
virtual bool | create ()=0 |
Creates the corresponding native graphics resources. | |
![]() | |
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 |
Public Attributes | |
QMetalGraphicsPipelineData * | d |
uint | generation = 0 |
int | lastActiveFrameSlot = -1 |
Friends | |
class | QRhiMetal |
Definition at line 211 of file qrhimetal_p.h.
QMetalGraphicsPipeline::QMetalGraphicsPipeline | ( | QRhiImplementation * | rhi | ) |
Definition at line 4318 of file qrhimetal.mm.
References d, QMetalGraphicsPipelineData::q, QMetalGraphicsPipelineData::Tessellation::q, and QMetalGraphicsPipelineData::tess.
QMetalGraphicsPipeline::~QMetalGraphicsPipeline | ( | ) |
|
overridevirtual |
Creates the corresponding native graphics resources.
If there are already resources present due to an earlier create() with no corresponding destroy(), then destroy() is called implicitly first.
true
when successful, false
when a graphics operation failed. Regardless of the return value, calling destroy() is always safe.VkPipelineCache
to improve data reuse during the lifetime of the application.Implements QRhiGraphicsPipeline.
Definition at line 5773 of file qrhimetal.mm.
References d, QRhiShaderStage::Fragment, QShader::isValid(), QShaderPrivate::MslBufferSizeBufferBinding, ok, qMakePair(), qMax(), QRHI_RES_RHI, QShader::shader(), QRhiBuffer::Static, QRhiBuffer::StorageBuffer, QRhiShaderStage::TessellationControl, QRhiShaderStage::TessellationEvaluation, and QRhiShaderStage::Vertex.
bool QMetalGraphicsPipeline::createTessellationPipelines | ( | const QShader & | tessVert, |
const QShader & | tesc, | ||
const QShader & | tese, | ||
const QShader & | tessFrag | ||
) |
Definition at line 5589 of file qrhimetal.mm.
References QShader::availableShaders(), QByteArray::constData(), d, QMetalShader::desc, QShader::description(), error, QMetalShader::func, init(), QMetalShader::lib, QMetalShader::nativeResourceBindingMap, QShader::nativeResourceBindingMap(), QMetalShader::nativeShaderInfo, QShader::nativeShaderInfo(), QShader::NonIndexedVertexAsComputeShader, qPrintable, QRHI_RES_RHI, qWarning, release(), QShader::StandardShader, QShaderDescription::tessellationOutputVertexCount(), QShader::UInt16IndexedVertexAsComputeShader, QShader::UInt32IndexedVertexAsComputeShader, and variant.
bool QMetalGraphicsPipeline::createVertexFragmentPipeline | ( | ) |
Definition at line 4927 of file qrhimetal.mm.
References QByteArray::constData(), d, QMetalShader::desc, QMetalGraphicsPipelineData::ds, QRhi::EnablePipelineCacheDataSave, error, QRhiShaderStage::Fragment, QMetalGraphicsPipelineData::fs, QMetalShader::func, init(), QMetalShader::lib, QRhiGraphicsPipeline::m_multiViewCount, QRhiGraphicsPipeline::m_renderPassDesc, QRhiGraphicsPipeline::m_shaderStages, QRhiGraphicsPipeline::m_topology, mapStates(), QRhiImplementation::MAX_SHADER_CACHE_ENTRIES, QMetalShader::nativeResourceBindingMap, QMetalShader::nativeShaderInfo, QMetalGraphicsPipelineData::primitiveType, QMetalGraphicsPipelineData::ps, qPrintable, QRHI_RES, QRHI_RES_RHI, qWarning, release(), setupAttachmentsInMetalRenderPassDescriptor(), setupMetalDepthStencilDescriptor(), QMetalGraphicsPipelineData::setupVertexInputDescriptor(), QShader::shader(), toMetalPrimitiveTopologyClass(), toMetalPrimitiveType(), QRhiShaderStage::Vertex, and QMetalGraphicsPipelineData::vs.
|
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 4332 of file qrhimetal.mm.
References QMetalGraphicsPipelineData::bufferSizeBuffer, QMetalGraphicsPipelineData::Tessellation::compTesc, QMetalGraphicsPipelineData::Tessellation::compVs, d, QMetalShader::destroy(), QMetalGraphicsPipelineData::ExtraBufferManager::deviceLocalWorkBuffers, QMetalGraphicsPipelineData::ds, e, QMetalGraphicsPipelineData::extraBufMgr, QMetalGraphicsPipelineData::fs, QRhiMetalData::DeferredReleaseEntry::GraphicsPipeline, QMetalGraphicsPipelineData::ExtraBufferManager::hostVisibleWorkBuffers, lastActiveFrameSlot, QMetalGraphicsPipelineData::ps, qDeleteAll(), QRHI_RES_RHI, QMetalGraphicsPipelineData::tess, QMetalGraphicsPipelineData::Tessellation::tessControlComputeState, QMetalGraphicsPipelineData::Tessellation::vertexComputeState, QMetalGraphicsPipelineData::Tessellation::vertTese, and QMetalGraphicsPipelineData::vs.
Referenced by ~QMetalGraphicsPipeline().
void QMetalGraphicsPipeline::makeActiveForCurrentRenderPassEncoder | ( | QMetalCommandBuffer * | cbD | ) |
Definition at line 1431 of file qrhimetal.mm.
References QMetalGraphicsPipelineData::cullMode, QMetalCommandBuffer::currentCullMode, QMetalCommandBuffer::currentDepthBiasValues, QMetalCommandBufferData::currentDepthStencilState, QMetalCommandBuffer::currentFrontFaceWinding, QMetalCommandBufferData::currentRenderPassEncoder, QMetalCommandBuffer::currentTriangleFillMode, d, QMetalCommandBuffer::d, QMetalGraphicsPipelineData::depthBias, QMetalGraphicsPipelineData::ds, QMetalGraphicsPipelineData::ps, qFuzzyCompare(), QRhiGraphicsPipeline::setCullMode(), QRhiGraphicsPipeline::setDepthBias(), QMetalGraphicsPipelineData::slopeScaledDepthBias, QMetalGraphicsPipelineData::triangleFillMode, and QMetalGraphicsPipelineData::winding.
Referenced by QRhiMetal::setGraphicsPipeline(), and QRhiMetal::tessellatedDraw().
void QMetalGraphicsPipeline::mapStates | ( | ) |
Definition at line 4807 of file qrhimetal.mm.
References QRhiGraphicsPipeline::CCW, QMetalGraphicsPipelineData::cullMode, d, QMetalGraphicsPipelineData::depthBias, QRhiGraphicsPipeline::m_cullMode, QRhiGraphicsPipeline::m_depthBias, QRhiGraphicsPipeline::m_frontFace, QRhiGraphicsPipeline::m_polygonMode, QRhiGraphicsPipeline::m_slopeScaledDepthBias, QMetalGraphicsPipelineData::slopeScaledDepthBias, toMetalCullMode(), toMetalTriangleFillMode(), QMetalGraphicsPipelineData::triangleFillMode, and QMetalGraphicsPipelineData::winding.
Referenced by createVertexFragmentPipeline().
void QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor | ( | void * | metalRpDesc, |
QMetalRenderPassDescriptor * | rpD | ||
) |
Definition at line 4738 of file qrhimetal.mm.
References QMetalRenderPassDescriptor::colorAttachmentCount, QMetalRenderPassDescriptor::colorFormat, QMetalRenderPassDescriptor::dsFormat, fmt, QMetalRenderPassDescriptor::hasDepthStencil, i, QRhiGraphicsPipeline::m_sampleCount, QRhiGraphicsPipeline::m_targetBlends, Q_ASSERT, QRHI_RES_RHI, toMetalBlendFactor(), toMetalBlendOp(), and toMetalColorWriteMask().
Referenced by createVertexFragmentPipeline(), and QMetalGraphicsPipelineData::Tessellation::teseFragRenderPipeline().
Definition at line 4782 of file qrhimetal.mm.
References QRhiGraphicsPipeline::StencilOpState::compareOp, QRhiGraphicsPipeline::StencilOpState::depthFailOp, QRhiGraphicsPipeline::StencilOpState::failOp, init(), QRhiGraphicsPipeline::m_depthOp, QRhiGraphicsPipeline::m_depthTest, QRhiGraphicsPipeline::m_depthWrite, QRhiGraphicsPipeline::m_stencilBack, QRhiGraphicsPipeline::m_stencilFront, QRhiGraphicsPipeline::m_stencilReadMask, QRhiGraphicsPipeline::m_stencilTest, QRhiGraphicsPipeline::m_stencilWriteMask, QRhiGraphicsPipeline::StencilOpState::passOp, toMetalCompareOp(), and toMetalStencilOp().
Referenced by createVertexFragmentPipeline().
|
friend |
Definition at line 228 of file qrhimetal_p.h.
QMetalGraphicsPipelineData* QMetalGraphicsPipeline::d |
Definition at line 225 of file qrhimetal_p.h.
Referenced by QMetalGraphicsPipeline(), ~QMetalGraphicsPipeline(), QRhiMetal::adjustForMultiViewDraw(), createVertexFragmentPipeline(), destroy(), QRhiMetal::draw(), QRhiMetal::drawIndexed(), makeActiveForCurrentRenderPassEncoder(), mapStates(), QRhiMetal::setGraphicsPipeline(), QRhiMetal::setShaderResources(), QMetalGraphicsPipelineData::Tessellation::teseFragRenderPipeline(), and QRhiMetal::tessellatedDraw().
uint QMetalGraphicsPipeline::generation = 0 |
Definition at line 226 of file qrhimetal_p.h.
Referenced by QRhiMetal::setGraphicsPipeline().
int QMetalGraphicsPipeline::lastActiveFrameSlot = -1 |
Definition at line 227 of file qrhimetal_p.h.
Referenced by destroy(), and QRhiMetal::setGraphicsPipeline().