GraphicsPipelineState Struct

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

ConstantValue
QSGMaterialShader::GraphicsPipelineState::Zero0
QSGMaterialShader::GraphicsPipelineState::One1
QSGMaterialShader::GraphicsPipelineState::SrcColor2
QSGMaterialShader::GraphicsPipelineState::OneMinusSrcColor3
QSGMaterialShader::GraphicsPipelineState::DstColor4
QSGMaterialShader::GraphicsPipelineState::OneMinusDstColor5
QSGMaterialShader::GraphicsPipelineState::SrcAlpha6
QSGMaterialShader::GraphicsPipelineState::OneMinusSrcAlpha7
QSGMaterialShader::GraphicsPipelineState::DstAlpha8
QSGMaterialShader::GraphicsPipelineState::OneMinusDstAlpha9
QSGMaterialShader::GraphicsPipelineState::ConstantColor10
QSGMaterialShader::GraphicsPipelineState::OneMinusConstantColor11
QSGMaterialShader::GraphicsPipelineState::ConstantAlpha12
QSGMaterialShader::GraphicsPipelineState::OneMinusConstantAlpha13
QSGMaterialShader::GraphicsPipelineState::SrcAlphaSaturate14
QSGMaterialShader::GraphicsPipelineState::Src1Color15
QSGMaterialShader::GraphicsPipelineState::OneMinusSrc1Color16
QSGMaterialShader::GraphicsPipelineState::Src1Alpha17
QSGMaterialShader::GraphicsPipelineState::OneMinusSrc1Alpha18

enum GraphicsPipelineState::ColorMaskComponent
flags GraphicsPipelineState::ColorMask

ConstantValue
QSGMaterialShader::GraphicsPipelineState::R1 << 0
QSGMaterialShader::GraphicsPipelineState::G1 << 1
QSGMaterialShader::GraphicsPipelineState::B1 << 2
QSGMaterialShader::GraphicsPipelineState::A1 << 3

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

enum GraphicsPipelineState::CullMode

ConstantValue
QSGMaterialShader::GraphicsPipelineState::CullNone0
QSGMaterialShader::GraphicsPipelineState::CullFront1
QSGMaterialShader::GraphicsPipelineState::CullBack2

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

ConstantValueDescription
QSGMaterialShader::GraphicsPipelineState::Fill0The interior of the polygon is filled (default)
QSGMaterialShader::GraphicsPipelineState::Line1Boundary edges of the polygon are drawn as line segments.

This enum was introduced in Qt 6.4.

Member Variable Documentation

QColor GraphicsPipelineState::blendConstant

Blend constant applicable when a blending factor is set to use a constant value.

bool GraphicsPipelineState::blendEnable

Enables blending.

Note: Changing this flag should be done with care, and is best avoided. Rather, materials should always use the QSGMaterial::Blend flag to indicate that they wish to use blending. Changing this value from false to true for a material that did not declare QSGMaterial::Blend can lead to unexpected visual results.

QSGMaterialShader::GraphicsPipelineState::ColorMask GraphicsPipelineState::colorWrite

Color write mask.

QSGMaterialShader::GraphicsPipelineState::CullMode GraphicsPipelineState::cullMode

Cull mode.

[since 6.5] QSGMaterialShader::GraphicsPipelineState::BlendFactor GraphicsPipelineState::dstAlpha

Destination alpha blending factor.

Applies only when separateBlendFactors is set to true.

This documentation was introduced in Qt 6.5.

QSGMaterialShader::GraphicsPipelineState::BlendFactor GraphicsPipelineState::dstColor

Destination blending factor, either RGB or RGBA depending on separateBlendFactors.

[since 6.4] QSGMaterialShader::GraphicsPipelineState::PolygonMode GraphicsPipelineState::polygonMode

Polygon rasterization mode.

This documentation was introduced in Qt 6.4.

[since 6.5] bool GraphicsPipelineState::separateBlendFactors

Indicates that alpha blending factors are specified separately.

False by default, meaning both RGB and alpha blending factors are defined by srcColor and dstColor. When set to true, the alpha blending factors are taken from srcAlpha and dstAlpha instead, and srcColor and dstColor applies only to RGB.

This documentation was introduced in Qt 6.5.

[since 6.5] QSGMaterialShader::GraphicsPipelineState::BlendFactor GraphicsPipelineState::srcAlpha

Source alpha blending factor.

Applies only when separateBlendFactors is set to true.

This documentation was introduced in Qt 6.5.

QSGMaterialShader::GraphicsPipelineState::BlendFactor GraphicsPipelineState::srcColor

Source blending factor, either RGB or RGBA depending on separateBlendFactors.