QRhiGraphicsPipeline Class
Graphics pipeline state resource. More...
Header: | #include <QRhiGraphicsPipeline> |
qmake: | QT += rhi |
Inherits: | QRhiResource |
Public Types
class | StencilOpState |
class | TargetBlend |
enum | BlendFactor { Zero, One, SrcColor, OneMinusSrcColor, ..., OneMinusSrc1Alpha } |
enum | BlendOp { Add, Subtract, ReverseSubtract, Min, Max } |
flags | ColorMask |
enum | ColorMaskComponent { R, G, B, A } |
enum | CompareOp { Never, Less, Equal, LessOrEqual, ..., Always } |
enum | CullMode { None, Front, Back } |
enum | Flag { UsesBlendConstants, UsesStencilRef, UsesScissor } |
flags | Flags |
enum | FrontFace { CCW, CW } |
enum | StencilOp { StencilZero, Keep, Replace, IncrementAndClamp, ..., DecrementAndWrap } |
enum | Topology { Triangles, TriangleStrip, Lines, LineStrip, Points } |
Public Functions
virtual bool | build() = 0 |
QRhiGraphicsPipeline::CullMode | cullMode() const |
QRhiGraphicsPipeline::CompareOp | depthOp() const |
QRhiGraphicsPipeline::Flags | flags() const |
QRhiGraphicsPipeline::FrontFace | frontFace() const |
bool | hasDepthTest() const |
bool | hasDepthWrite() const |
bool | hasStencilTest() const |
QRhiRenderPassDescriptor * | renderPassDescriptor() const |
int | sampleCount() const |
void | setCullMode(QRhiGraphicsPipeline::CullMode mode) |
void | setDepthOp(QRhiGraphicsPipeline::CompareOp op) |
void | setDepthTest(bool enable) |
void | setDepthWrite(bool enable) |
void | setFlags(QRhiGraphicsPipeline::Flags f) |
void | setFrontFace(QRhiGraphicsPipeline::FrontFace f) |
void | setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) |
void | setSampleCount(int s) |
void | setShaderResourceBindings(QRhiShaderResourceBindings *srb) |
void | setShaderStages(const QVector<QRhiShaderStage> &stages) |
void | setStencilBack(const QRhiGraphicsPipeline::StencilOpState &state) |
void | setStencilFront(const QRhiGraphicsPipeline::StencilOpState &state) |
void | setStencilReadMask(quint32 mask) |
void | setStencilTest(bool enable) |
void | setStencilWriteMask(quint32 mask) |
void | setTargetBlends(const QVector<QRhiGraphicsPipeline::TargetBlend> &blends) |
void | setTopology(QRhiGraphicsPipeline::Topology t) |
void | setVertexInputLayout(const QRhiVertexInputLayout &layout) |
QRhiShaderResourceBindings * | shaderResourceBindings() const |
QVector<QRhiShaderStage> | shaderStages() const |
QRhiGraphicsPipeline::StencilOpState | stencilBack() const |
QRhiGraphicsPipeline::StencilOpState | stencilFront() const |
quint32 | stencilReadMask() const |
quint32 | stencilWriteMask() const |
QVector<QRhiGraphicsPipeline::TargetBlend> | targetBlends() const |
QRhiGraphicsPipeline::Topology | topology() const |
QRhiVertexInputLayout | vertexInputLayout() const |
Reimplemented Public Functions
virtual QRhiResource::Type | resourceType() const override |
- 6 public functions inherited from QRhiResource
Protected Variables
QRhiGraphicsPipeline::CullMode | m_cullMode |
QRhiGraphicsPipeline::CompareOp | m_depthOp |
bool | m_depthTest |
bool | m_depthWrite |
QRhiGraphicsPipeline::Flags | m_flags |
QRhiGraphicsPipeline::FrontFace | m_frontFace |
QRhiRenderPassDescriptor * | m_renderPassDesc |
int | m_sampleCount |
QRhiShaderResourceBindings * | m_shaderResourceBindings |
QVector<QRhiShaderStage> | m_shaderStages |
QRhiGraphicsPipeline::StencilOpState | m_stencilBack |
QRhiGraphicsPipeline::StencilOpState | m_stencilFront |
quint32 | m_stencilReadMask |
bool | m_stencilTest |
quint32 | m_stencilWriteMask |
QVector<QRhiGraphicsPipeline::TargetBlend> | m_targetBlends |
QRhiGraphicsPipeline::Topology | m_topology |
QRhiVertexInputLayout | m_vertexInputLayout |
- 3 protected variables inherited from QRhiResource
Additional Inherited Members
- 1 protected function inherited from QRhiResource
Detailed Description
Graphics pipeline state resource.
Note: Setting the shader resource bindings is mandatory. The referenced QRhiShaderResourceBindings must already be built by the time build() is called.
Note: Setting the render pass descriptor is mandatory. To obtain a QRhiRenderPassDescriptor that can be passed to setRenderPassDescriptor(), use either QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor() or QRhiSwapChain::newCompatibleRenderPassDescriptor().
Note: Setting the vertex input layout is mandatory.
Note: Setting the shader stages is mandatory.
Note: sampleCount() defaults to 1 and must match the sample count of the render target's color and depth stencil attachments.
Note: The depth test, depth write, and stencil test are disabled by default.
Note: stencilReadMask() and stencilWriteMask() apply to both faces. They both default to 0xFF.
Member Type Documentation
enum QRhiGraphicsPipeline::BlendFactor
Specifies the blend factor
Constant | Value |
---|---|
QRhiGraphicsPipeline::Zero | 0 |
QRhiGraphicsPipeline::One | 1 |
QRhiGraphicsPipeline::SrcColor | 2 |
QRhiGraphicsPipeline::OneMinusSrcColor | 3 |
QRhiGraphicsPipeline::DstColor | 4 |
QRhiGraphicsPipeline::OneMinusDstColor | 5 |
QRhiGraphicsPipeline::SrcAlpha | 6 |
QRhiGraphicsPipeline::OneMinusSrcAlpha | 7 |
QRhiGraphicsPipeline::DstAlpha | 8 |
QRhiGraphicsPipeline::OneMinusDstAlpha | 9 |
QRhiGraphicsPipeline::ConstantColor | 10 |
QRhiGraphicsPipeline::OneMinusConstantColor | 11 |
QRhiGraphicsPipeline::ConstantAlpha | 12 |
QRhiGraphicsPipeline::OneMinusConstantAlpha | 13 |
QRhiGraphicsPipeline::SrcAlphaSaturate | 14 |
QRhiGraphicsPipeline::Src1Color | 15 |
QRhiGraphicsPipeline::OneMinusSrc1Color | 16 |
QRhiGraphicsPipeline::Src1Alpha | 17 |
QRhiGraphicsPipeline::OneMinusSrc1Alpha | 18 |
enum QRhiGraphicsPipeline::BlendOp
Specifies the blend operation
Constant | Value |
---|---|
QRhiGraphicsPipeline::Add | 0 |
QRhiGraphicsPipeline::Subtract | 1 |
QRhiGraphicsPipeline::ReverseSubtract | 2 |
QRhiGraphicsPipeline::Min | 3 |
QRhiGraphicsPipeline::Max | 4 |
enum QRhiGraphicsPipeline::ColorMaskComponent
flags QRhiGraphicsPipeline::ColorMask
Flag values for specifying the color write mask
Constant | Value |
---|---|
QRhiGraphicsPipeline::R | 1 << 0 |
QRhiGraphicsPipeline::G | 1 << 1 |
QRhiGraphicsPipeline::B | 1 << 2 |
QRhiGraphicsPipeline::A | 1 << 3 |
The ColorMask type is a typedef for QFlags<ColorMaskComponent>. It stores an OR combination of ColorMaskComponent values.
enum QRhiGraphicsPipeline::CompareOp
Specifies the depth or stencil comparison function
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::Never | 0 | |
QRhiGraphicsPipeline::Less | 1 | (default for depth) |
QRhiGraphicsPipeline::Equal | 2 | |
QRhiGraphicsPipeline::LessOrEqual | 3 | |
QRhiGraphicsPipeline::Greater | 4 | |
QRhiGraphicsPipeline::NotEqual | 5 | |
QRhiGraphicsPipeline::GreaterOrEqual | 6 | |
QRhiGraphicsPipeline::Always | 7 | (default for stencil) |
enum QRhiGraphicsPipeline::CullMode
Specifies the culling mode
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::None | 0 | No culling (default) |
QRhiGraphicsPipeline::Front | 1 | Cull front faces |
QRhiGraphicsPipeline::Back | 2 | Cull back faces |
enum QRhiGraphicsPipeline::Flag
flags QRhiGraphicsPipeline::Flags
Flag values for describing the dynamic state of the pipeline. The viewport is always dynamic.
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::UsesBlendConstants | 1 << 0 | Indicates that a blend color constant will be set via QRhiCommandBuffer::setBlendConstants() |
QRhiGraphicsPipeline::UsesStencilRef | 1 << 1 | Indicates that a stencil reference value will be set via QRhiCommandBuffer::setStencilRef() |
QRhiGraphicsPipeline::UsesScissor | 1 << 2 | Indicates that a scissor rectangle will be set via QRhiCommandBuffer::setScissor() |
The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.
enum QRhiGraphicsPipeline::FrontFace
Specifies the front face winding order
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::CCW | 0 | Counter clockwise (default) |
QRhiGraphicsPipeline::CW | 1 | Clockwise |
enum QRhiGraphicsPipeline::StencilOp
Specifies the stencil operation
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::StencilZero | 0 | |
QRhiGraphicsPipeline::Keep | 1 | (default) |
QRhiGraphicsPipeline::Replace | 2 | |
QRhiGraphicsPipeline::IncrementAndClamp | 3 | |
QRhiGraphicsPipeline::DecrementAndClamp | 4 | |
QRhiGraphicsPipeline::Invert | 5 | |
QRhiGraphicsPipeline::IncrementAndWrap | 6 | |
QRhiGraphicsPipeline::DecrementAndWrap | 7 |
enum QRhiGraphicsPipeline::Topology
Specifies the primitive topology
Constant | Value | Description |
---|---|---|
QRhiGraphicsPipeline::Triangles | 0 | (default) |
QRhiGraphicsPipeline::TriangleStrip | 1 | |
QRhiGraphicsPipeline::Lines | 2 | |
QRhiGraphicsPipeline::LineStrip | 3 | |
QRhiGraphicsPipeline::Points | 4 |
Property Documentation
Member Function Documentation
[pure virtual]
bool QRhiGraphicsPipeline::build()
Creates the corresponding native graphics resources. If there are already resources present due to an earlier build() with no corresponding release(), then release() is called implicitly first.
Returns true
when successful, false
when a graphics operation failed. Regardless of the return value, calling release() is always safe.
QRhiGraphicsPipeline::CullMode QRhiGraphicsPipeline::cullMode() const
See also setCullMode().
QRhiGraphicsPipeline::CompareOp QRhiGraphicsPipeline::depthOp() const
See also setDepthOp().
QRhiGraphicsPipeline::Flags QRhiGraphicsPipeline::flags() const
See also setFlags().
QRhiGraphicsPipeline::FrontFace QRhiGraphicsPipeline::frontFace() const
See also setFrontFace().
bool QRhiGraphicsPipeline::hasDepthTest() const
bool QRhiGraphicsPipeline::hasDepthWrite() const
bool QRhiGraphicsPipeline::hasStencilTest() const
QRhiRenderPassDescriptor *QRhiGraphicsPipeline::renderPassDescriptor() const
See also setRenderPassDescriptor().
[override virtual]
QRhiResource::Type QRhiGraphicsPipeline::resourceType() const
Reimplemented from QRhiResource::resourceType().
Returns the resource type.
int QRhiGraphicsPipeline::sampleCount() const
See also setSampleCount().
void QRhiGraphicsPipeline::setCullMode(QRhiGraphicsPipeline::CullMode mode)
See also cullMode().
void QRhiGraphicsPipeline::setDepthOp(QRhiGraphicsPipeline::CompareOp op)
See also depthOp().
void QRhiGraphicsPipeline::setDepthTest(bool enable)
Enables or disables depth testing. Both depth test and the writing out of depth data are disabled by default.
See also hasDepthTest() and setDepthWrite().
void QRhiGraphicsPipeline::setDepthWrite(bool enable)
Controls the writing out of depth data into the depth buffer. By default this is disabled. Depth write is typically enabled together with the depth test.
Note: Enabling depth write without having depth testing enabled may not lead to the desired result, and should be avoided.
See also hasDepthWrite() and setDepthTest().
void QRhiGraphicsPipeline::setFlags(QRhiGraphicsPipeline::Flags f)
See also flags().
void QRhiGraphicsPipeline::setFrontFace(QRhiGraphicsPipeline::FrontFace f)
See also frontFace().
void QRhiGraphicsPipeline::setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
See also renderPassDescriptor().
void QRhiGraphicsPipeline::setSampleCount(int s)
See also sampleCount().
void QRhiGraphicsPipeline::setShaderResourceBindings(QRhiShaderResourceBindings *srb)
See also shaderResourceBindings().
void QRhiGraphicsPipeline::setShaderStages(const QVector<QRhiShaderStage> &stages)
See also shaderStages().
void QRhiGraphicsPipeline::setStencilBack(const QRhiGraphicsPipeline::StencilOpState &state)
See also stencilBack().
void QRhiGraphicsPipeline::setStencilFront(const QRhiGraphicsPipeline::StencilOpState &state)
See also stencilFront().
void QRhiGraphicsPipeline::setStencilReadMask(quint32 mask)
See also stencilReadMask().
void QRhiGraphicsPipeline::setStencilTest(bool enable)
See also hasStencilTest().
void QRhiGraphicsPipeline::setStencilWriteMask(quint32 mask)
See also stencilWriteMask().
void QRhiGraphicsPipeline::setTargetBlends(const QVector<QRhiGraphicsPipeline::TargetBlend> &blends)
Sets the blend specification for color attachments. Each element in blends corresponds to a color attachment of the render target.
By default no blends are set, which is a shortcut to disabling blending and enabling color write for all four channels.
See also targetBlends().
void QRhiGraphicsPipeline::setTopology(QRhiGraphicsPipeline::Topology t)
See also topology().
void QRhiGraphicsPipeline::setVertexInputLayout(const QRhiVertexInputLayout &layout)
See also vertexInputLayout().
QRhiShaderResourceBindings *QRhiGraphicsPipeline::shaderResourceBindings() const
See also setShaderResourceBindings().
QVector<QRhiShaderStage> QRhiGraphicsPipeline::shaderStages() const
See also setShaderStages().
QRhiGraphicsPipeline::StencilOpState QRhiGraphicsPipeline::stencilBack() const
See also setStencilBack().
QRhiGraphicsPipeline::StencilOpState QRhiGraphicsPipeline::stencilFront() const
See also setStencilFront().
quint32 QRhiGraphicsPipeline::stencilReadMask() const
See also setStencilReadMask().
quint32 QRhiGraphicsPipeline::stencilWriteMask() const
See also setStencilWriteMask().
QVector<QRhiGraphicsPipeline::TargetBlend> QRhiGraphicsPipeline::targetBlends() const
See also setTargetBlends().
QRhiGraphicsPipeline::Topology QRhiGraphicsPipeline::topology() const
See also setTopology().
QRhiVertexInputLayout QRhiGraphicsPipeline::vertexInputLayout() const
See also setVertexInputLayout().