![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Classes | |
struct | StencilOpState |
\variable QRhiGraphicsPipeline::TargetBlend::colorWrite More... | |
struct | TargetBlend |
\inmodule QtGui More... | |
Public Member Functions | |
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 |
Protected Member Functions | |
QRhiGraphicsPipeline (QRhiImplementation *rhi) | |
\variable QRhiGraphicsPipeline::StencilOpState::failOp | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
Protected Attributes | |
Flags | m_flags |
Topology | m_topology = Triangles |
CullMode | m_cullMode = None |
FrontFace | m_frontFace = CCW |
QVarLengthArray< TargetBlend, 8 > | m_targetBlends |
bool | m_depthTest = false |
bool | m_depthWrite = false |
CompareOp | m_depthOp = Less |
bool | m_stencilTest = false |
StencilOpState | m_stencilFront |
StencilOpState | m_stencilBack |
quint32 | m_stencilReadMask = 0xFF |
quint32 | m_stencilWriteMask = 0xFF |
int | m_sampleCount = 1 |
float | m_lineWidth = 1.0f |
int | m_depthBias = 0 |
float | m_slopeScaledDepthBias = 0.0f |
int | m_patchControlPointCount = 3 |
PolygonMode | m_polygonMode = Fill |
int | m_multiViewCount = 0 |
QVarLengthArray< QRhiShaderStage, 4 > | m_shaderStages |
QRhiVertexInputLayout | m_vertexInputLayout |
QRhiShaderResourceBindings * | m_shaderResourceBindings = nullptr |
QRhiRenderPassDescriptor * | m_renderPassDesc = nullptr |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
\inmodule QtGui
Graphics pipeline state resource.
Represents a graphics pipeline. What exactly this map to in the underlying native graphics API, varies. Where there is a concept of pipeline objects, for example with Vulkan, the QRhi backend will create such an object upon calling create(). Elsewhere, for example with OpenGL, the QRhiGraphicsPipeline may merely collect the various state, and create()'s main task is to set up the corresponding shader program, but deferring looking at any of the requested state to a later point.
As with all QRhiResource subclasses, the two-phased initialization pattern applies: setting any values via the setters, for example setDepthTest(), is only effective after calling create(). Avoid changing any values once the QRhiGraphicsPipeline has been initialized via create(). To change some state, set the new value and call create() again. However, that will effectively release all underlying native resources and create new ones. As a result, it may be a heavy, expensive operation. Rather, prefer creating multiple pipelines with the different states, and \l{QRhiCommandBuffer::setGraphicsPipeline()}{switch between them} when recording the render pass.
Specifies the blend factor.
\value Zero \value One \value SrcColor \value OneMinusSrcColor \value DstColor \value OneMinusDstColor \value SrcAlpha \value OneMinusSrcAlpha \value DstAlpha \value OneMinusDstAlpha \value ConstantColor \value OneMinusConstantColor \value ConstantAlpha \value OneMinusConstantAlpha \value SrcAlphaSaturate \value Src1Color \value OneMinusSrc1Color \value Src1Alpha \value OneMinusSrc1Alpha
Flag values for describing the dynamic state of the pipeline, and other options.
The viewport is always dynamic.
\value UsesBlendConstants Indicates that a blend color constant will be set via QRhiCommandBuffer::setBlendConstants()
\value UsesStencilRef Indicates that a stencil reference value will be set via QRhiCommandBuffer::setStencilRef()
\value UsesScissor Indicates that a scissor rectangle will be set via QRhiCommandBuffer::setScissor()
\value CompileShadersWithDebugInfo Requests compiling shaders with debug information enabled. This is relevant only when runtime shader compilation from source code is involved, and only when the underlying infrastructure supports this. With concrete examples, this is not relevant with Vulkan and SPIR-V, because the GLSL-to-SPIR-V compilation does not happen at run time. On the other hand, consider Direct3D and HLSL, where there are multiple options: when the QShader packages ship with pre-compiled bytecode (DXBC
), debug information is to be requested through the tool that generates the {.qsb} file, similarly to the case of Vulkan and SPIR-V. However, when having HLSL source code in the pre- or runtime-generated QShader packages, the first phase of compilation (HLSL source to intermediate format) happens at run time too, with this flag taken into account. Debug information is relevant in particular with tools like RenderDoc since it allows seeing the original source code when investigating the pipeline and when performing vertex or fragment shader debugging.
Enumerator | |
---|---|
UsesBlendConstants | |
UsesStencilRef | |
UsesScissor | |
CompileShadersWithDebugInfo |
Specifies the polygon rasterization mode.
Polygon Mode (Triangle Fill Mode in Metal, Fill Mode in D3D) specifies the fill mode used when rasterizing polygons. Polygons may be drawn as solids (Fill), or as a wire mesh (Line).
Support for non-fill polygon modes is optional and is indicated by the QRhi::NonFillPolygonMode feature. With OpenGL ES and some Vulkan implementations the feature will likely be reported as unsupported, which then means values other than Fill cannot be used.
\value Fill The interior of the polygon is filled (default) \value Line Boundary edges of the polygon are drawn as line segments.
Enumerator | |
---|---|
Fill | |
Line |
Specifies the stencil operation.
\value StencilZero \value Keep (default) \value Replace \value IncrementAndClamp \value DecrementAndClamp \value Invert \value IncrementAndWrap \value DecrementAndWrap
Enumerator | |
---|---|
StencilZero | |
Keep | |
Replace | |
IncrementAndClamp | |
DecrementAndClamp | |
Invert | |
IncrementAndWrap | |
DecrementAndWrap |
Specifies the primitive topology.
\value Triangles (default) \value TriangleStrip \value TriangleFan (only available if QRhi::TriangleFanTopology is supported) \value Lines \value LineStrip \value Points
\value Patches (only available if QRhi::Tessellation is supported, and requires the tessellation stages to be present in the pipeline)
Enumerator | |
---|---|
Triangles | |
TriangleStrip | |
TriangleFan | |
Lines | |
LineStrip | |
Points | |
Patches |
|
protected |
|
inline |
Definition at line 1424 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckGraphicsPipeline().
|
inline |
|
inline |
Definition at line 1425 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckGraphicsPipeline().
|
inline |
|
pure virtual |
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.Implemented in QD3D11GraphicsPipeline, QGles2GraphicsPipeline, QMetalGraphicsPipeline, QNullGraphicsPipeline, and QVkGraphicsPipeline.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), createGraphicsPipeline(), QSSGRhiContext::pipeline(), renderToKTXFileInternal(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1435 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckGraphicsPipeline(), and QMetalGraphicsPipelineData::Tessellation::teseFragRenderPipeline().
|
overridevirtual |
Implements QRhiResource.
Definition at line 6478 of file qrhi.cpp.
References QRhiResource::GraphicsPipeline.
|
inline |
Sets the specified face culling mode.
Definition at line 1364 of file qrhi.h.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), QMetalGraphicsPipeline::makeActiveForCurrentRenderPassEncoder(), QSSGRhiContext::pipeline(), and renderToKTXFileInternal().
|
inline |
Sets the depth bias.
The default value is 0.
Definition at line 1412 of file qrhi.h.
Referenced by QMetalGraphicsPipeline::makeActiveForCurrentRenderPassEncoder(), and QSSGRhiContext::pipeline().
Sets the depth comparison function op.
Definition at line 1388 of file qrhi.h.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), QSSGRhiContext::pipeline(), and renderToKTXFileInternal().
|
inline |
Enables or disables depth testing based on enable.
Both depth test and the writing out of depth data are disabled by default.
Definition at line 1382 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
Controls the writing out of depth data into the depth buffer based on enable.
By default this is disabled. Depth write is typically enabled together with the depth test.
Definition at line 1385 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
Sets the flags f.
Definition at line 1358 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
Sets the front face mode f.
Definition at line 1367 of file qrhi.h.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), and renderToKTXFileInternal().
|
inline |
Sets the line width.
If the QRhi::WideLines feature is reported as unsupported at runtime, values other than 1.0f are ignored.
Definition at line 1409 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
Sets the view count for multiview rendering.
The default is 0, indicating no multiview rendering. count must be 2 or larger to trigger multiview rendering.
Multiview is only available when the \l{QRhi::MultiView}{MultiView feature} is reported as supported. The render target must be a 2D texture array, and the color attachment for the render target must have the same count set.
See QRhiColorAttachment::setMultiViewCount() for further details on multiview rendering.
|
inline |
|
inline |
Sets the polygon mode.
The default is Fill.
Definition at line 1442 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
Associates with the specified QRhiRenderPassDescriptor desc.
Definition at line 1436 of file qrhi.h.
References desc.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), createGraphicsPipeline(), QSSGRhiContext::pipeline(), renderToKTXFileInternal(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
Sets the sample count.
Typical values for s are 1, 4, or 8. The pipeline must always be compatible with the render target, i.e. the sample counts must match.
Definition at line 1406 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
Associates with srb describing the resource binding layout and the resources (QRhiBuffer, QRhiTexture) themselves.
The latter is optional, because only the layout matters during pipeline creation. Therefore, the srb passed in here can leave the actual buffer or texture objects unspecified (\nullptr) as long as there is another, \l{QRhiShaderResourceBindings::isLayoutCompatible()}{layout-compatible} QRhiShaderResourceBindings bound via \l{QRhiCommandBuffer::setShaderResources()}{setShaderResources()} before recording the draw calls.
Definition at line 1433 of file qrhi.h.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), createGraphicsPipeline(), QSSGRhiContext::pipeline(), renderToKTXFileInternal(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
|
inline |
Sets the list of shader stages.
Definition at line 1417 of file qrhi.h.
References list.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), createGraphicsPipeline(), QSSGRhiContext::pipeline(), renderToKTXFileInternal(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
Sets the slope scaled depth bias.
The default value is 0.
Definition at line 1415 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
|
inline |
Sets the stencil test state for front faces.
Definition at line 1394 of file qrhi.h.
References state.
Referenced by QSSGRhiContext::pipeline().
|
inline |
Enables or disables stencil tests based on enable.
By default this is disabled.
Definition at line 1391 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
Sets the stencil write mask.
The default value is 0xFF.
Definition at line 1403 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline().
|
inline |
|
inline |
Sets the list of render target blend settings.
This is a list because when multiple render targets are used (i.e., a QRhiTextureRenderTarget with more than one QRhiColorAttachment), there needs to be a TargetBlend structure per render target (color attachment).
By default there is one default-constructed TargetBlend set.
Definition at line 1369 of file qrhi.h.
References list.
Referenced by createGraphicsPipeline(), and QSSGRhiContext::pipeline().
Sets the primitive topology t.
Definition at line 1361 of file qrhi.h.
Referenced by QSSGRhiContext::pipeline(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
Specifies the vertex input layout.
Definition at line 1430 of file qrhi.h.
References layout.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), createGraphicsPipeline(), QSSGRhiContext::pipeline(), renderToKTXFileInternal(), and QVideoWindowPrivate::setupGraphicsPipeline().
|
inline |
Definition at line 1432 of file qrhi.h.
Referenced by QRhiImplementation::sanityCheckGraphicsPipeline(), and QRhiMetal::setVertexInput().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1453 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::mapStates().
|
protected |
Definition at line 1466 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::mapStates().
Definition at line 1458 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1456 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1457 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1451 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), QRhiMetal::setScissor(), and QRhiMetal::setViewport().
Definition at line 1454 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::mapStates().
|
protected |
Definition at line 1465 of file qrhi.h.
Referenced by QVkGraphicsPipeline::create(), and QRhiGles2::executeBindGraphicsPipeline().
|
protected |
Definition at line 1470 of file qrhi.h.
Referenced by QRhiMetal::adjustForMultiViewDraw(), and QMetalGraphicsPipeline::createVertexFragmentPipeline().
|
protected |
Definition at line 1468 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), and QRhiGles2::executeBindGraphicsPipeline().
|
protected |
Definition at line 1469 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::mapStates().
|
protected |
Definition at line 1474 of file qrhi.h.
Referenced by QVkGraphicsPipeline::create(), and QMetalGraphicsPipeline::createVertexFragmentPipeline().
|
protected |
Definition at line 1464 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), and QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor().
|
protected |
Definition at line 1473 of file qrhi.h.
Referenced by QVkGraphicsPipeline::create(), QRhiD3D11::setShaderResources(), QRhiGles2::setShaderResources(), QRhiMetal::setShaderResources(), and QRhiVulkan::setShaderResources().
|
protected |
Definition at line 1471 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QGles2GraphicsPipeline::create(), QVkGraphicsPipeline::create(), and QMetalGraphicsPipeline::createVertexFragmentPipeline().
|
protected |
Definition at line 1467 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::mapStates().
|
protected |
Definition at line 1461 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), QRhiGles2::executeCommandBuffer(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1460 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), QRhiGles2::executeCommandBuffer(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1462 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), QRhiGles2::executeCommandBuffer(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1459 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1463 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupMetalDepthStencilDescriptor().
|
protected |
Definition at line 1455 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeBindGraphicsPipeline(), and QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor().
Definition at line 1452 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QGles2GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QMetalGraphicsPipeline::createVertexFragmentPipeline(), and QRhiGles2::executeBindGraphicsPipeline().
|
protected |
Definition at line 1472 of file qrhi.h.
Referenced by QD3D11GraphicsPipeline::create(), QVkGraphicsPipeline::create(), QRhiGles2::executeCommandBuffer(), and QRhiD3D11::setVertexInput().