QSGMaterialShader::GraphicsPipelineState Struct | Qt Quick (original) (raw)

struct QSGMaterialShader::GraphicsPipelineState

Describes state changes that the material wants to apply to the currently active graphics pipeline state. More...

Public Types

enum BlendFactor { Zero, One, SrcColor, OneMinusSrcColor, DstColor, …, OneMinusSrc1Alpha }
(since 6.8) enum class BlendOp { Add, Subtract, ReverseSubtract, Min, Max }
flags ColorMask
enum ColorMaskComponent { R, G, B, A }
enum CullMode { CullNone, CullFront, CullBack }
(since 6.4) enum PolygonMode { Fill, Line }

Public Variables

QColor blendConstant
bool blendEnable
QSGMaterialShader::GraphicsPipelineState::ColorMask colorWrite
QSGMaterialShader::GraphicsPipelineState::CullMode cullMode
(since 6.5) QSGMaterialShader::GraphicsPipelineState::BlendFactor dstAlpha
QSGMaterialShader::GraphicsPipelineState::BlendFactor dstColor
(since 6.8) QSGMaterialShader::GraphicsPipelineState::BlendOp opAlpha
(since 6.8) QSGMaterialShader::GraphicsPipelineState::BlendOp opColor
(since 6.4) QSGMaterialShader::GraphicsPipelineState::PolygonMode polygonMode
(since 6.5) bool separateBlendFactors
(since 6.5) QSGMaterialShader::GraphicsPipelineState::BlendFactor srcAlpha
QSGMaterialShader::GraphicsPipelineState::BlendFactor srcColor

Detailed Description

Unlike QSGMaterialShader, directly issuing state change commands with the underlying graphics API is not possible with QSGMaterialShader. This is mainly because the concept of individually changeable states is considered deprecated and not supported with modern graphics APIs.

Therefore, it is up to QSGMaterialShader to expose a data structure with the set of supported states, which the material can change in its updatePipelineState() implementation, if there is one. The scenegraph will then internally apply these changes to the active graphics pipeline state, then rolling them back as appropriate.

When updateGraphicsPipelineState() is called, the struct has all members set to a valid value to reflect the renderer's current state. Not changing any values (or not reimplementing the function) indicates that the material is fine with the defaults (which are dynamic however, depending on QSGMaterial flags, for example).

Member Type Documentation

enum GraphicsPipelineState::BlendFactor

Constant Value
QSGMaterialShader::GraphicsPipelineState::Zero 0
QSGMaterialShader::GraphicsPipelineState::One 1
QSGMaterialShader::GraphicsPipelineState::SrcColor 2
QSGMaterialShader::GraphicsPipelineState::OneMinusSrcColor 3
QSGMaterialShader::GraphicsPipelineState::DstColor 4
QSGMaterialShader::GraphicsPipelineState::OneMinusDstColor 5
QSGMaterialShader::GraphicsPipelineState::SrcAlpha 6
QSGMaterialShader::GraphicsPipelineState::OneMinusSrcAlpha 7
QSGMaterialShader::GraphicsPipelineState::DstAlpha 8
QSGMaterialShader::GraphicsPipelineState::OneMinusDstAlpha 9
QSGMaterialShader::GraphicsPipelineState::ConstantColor 10
QSGMaterialShader::GraphicsPipelineState::OneMinusConstantColor 11
QSGMaterialShader::GraphicsPipelineState::ConstantAlpha 12
QSGMaterialShader::GraphicsPipelineState::OneMinusConstantAlpha 13
QSGMaterialShader::GraphicsPipelineState::SrcAlphaSaturate 14
QSGMaterialShader::GraphicsPipelineState::Src1Color 15
QSGMaterialShader::GraphicsPipelineState::OneMinusSrc1Color 16
QSGMaterialShader::GraphicsPipelineState::Src1Alpha 17
QSGMaterialShader::GraphicsPipelineState::OneMinusSrc1Alpha 18

[since 6.8] enum class GraphicsPipelineState::BlendOp

Constant Value
QSGMaterialShader::GraphicsPipelineState::BlendOp::Add 0
QSGMaterialShader::GraphicsPipelineState::BlendOp::Subtract 1
QSGMaterialShader::GraphicsPipelineState::BlendOp::ReverseSubtract 2
QSGMaterialShader::GraphicsPipelineState::BlendOp::Min 3
QSGMaterialShader::GraphicsPipelineState::BlendOp::Max 4

This enum was introduced in Qt 6.8.

enum GraphicsPipelineState::ColorMaskComponent

flags GraphicsPipelineState::ColorMask

Constant Value
QSGMaterialShader::GraphicsPipelineState::R 1 << 0
QSGMaterialShader::GraphicsPipelineState::G 1 << 1
QSGMaterialShader::GraphicsPipelineState::B 1 << 2
QSGMaterialShader::GraphicsPipelineState::A 1 << 3

The ColorMask type is a typedef for QFlags. It stores an OR combination of ColorMaskComponent values.

enum GraphicsPipelineState::CullMode

Constant Value
QSGMaterialShader::GraphicsPipelineState::CullNone 0
QSGMaterialShader::GraphicsPipelineState::CullFront 1
QSGMaterialShader::GraphicsPipelineState::CullBack 2

[since 6.4] enum GraphicsPipelineState::PolygonMode

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).

Warning: OpenGL ES does not support the Line polygon mode. OpenGL ES will rasterize all polygons as filled no matter what polygon mode is set. Using Line will make your application non-portable.

Constant Value Description
QSGMaterialShader::GraphicsPipelineState::Fill 0 The interior of the polygon is filled (default)
QSGMaterialShader::GraphicsPipelineState::Line 1 Boundary edges of the polygon are drawn as line segments.

This enum was introduced in Qt 6.4.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.