![]() |
Qt 6.x
The Qt SDK
|
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and the other update
type of functions.
More...
#include <qsgmaterialshader.h>
Public Types | |
enum | DirtyState { DirtyMatrix = 0x0001 , DirtyOpacity = 0x0002 , DirtyCachedMaterialData = 0x0004 , DirtyAll = 0xFFFF } |
\value DirtyMatrix Used to indicate that the matrix has changed and must be updated. More... | |
Public Member Functions | |
DirtyStates | dirtyStates () const |
Returns which rendering states that have changed and needs to be updated for geometry rendered with this material to conform to the current rendering state. | |
bool | isMatrixDirty () const |
Returns true if the dirtyStates() contain the dirty matrix state, otherwise returns false . | |
bool | isOpacityDirty () const |
Returns true if the dirtyStates() contains the dirty opacity state, otherwise returns false . | |
float | opacity () const |
\variable QSGMaterialShader::GraphicsPipelineState::blendEnable | |
QMatrix4x4 | combinedMatrix () const |
Returns the matrix combined of modelview matrix and project matrix. | |
QMatrix4x4 | modelViewMatrix () const |
Returns the model view matrix. | |
QMatrix4x4 | projectionMatrix () const |
Returns the projection matrix. | |
QRect | viewportRect () const |
Returns the viewport rect of the surface being rendered to. | |
QRect | deviceRect () const |
Returns the device rect of the surface being rendered to. | |
float | determinant () const |
Returns the modelview determinant to be used for rendering. | |
float | devicePixelRatio () const |
Returns the ratio between physical pixels and device-independent pixels to be used for rendering. | |
QByteArray * | uniformData () |
Returns a pointer to the data for the uniform (constant) buffer in the shader. | |
QRhiResourceUpdateBatch * | resourceUpdateBatch () |
Returns a resource update batch to which upload and copy operatoins can be queued. | |
QRhi * | rhi () |
Returns the current QRhi. | |
Friends | |
class | QSGRenderer |
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and the other update
type of functions.
\inmodule QtQuick
The render state contains a number of accessors that the shader needs to respect in order to conform to the current state of the scene graph.
Definition at line 25 of file qsgmaterialshader.h.
\value DirtyMatrix Used to indicate that the matrix has changed and must be updated.
\value DirtyOpacity Used to indicate that the opacity has changed and must be updated.
\value DirtyCachedMaterialData Used to indicate that the cached material state has changed and must be updated.
\value DirtyAll Used to indicate that everything needs to be updated.
Enumerator | |
---|---|
DirtyMatrix | |
DirtyOpacity | |
DirtyCachedMaterialData | |
DirtyAll |
Definition at line 27 of file qsgmaterialshader.h.
QMatrix4x4 QSGMaterialShader::RenderState::combinedMatrix | ( | ) | const |
Returns the matrix combined of modelview matrix and project matrix.
Definition at line 768 of file qsgmaterialshader.cpp.
References m_data, and Q_ASSERT.
Referenced by TabledMaterialRhiShader::updateUniformData(), DeformableMaterialRhiShader::updateUniformData(), ParticleSpriteMaterialRhiShader::updateUniformData(), ColoredPointMaterialRhiShader::updateUniformData(), and SimplePointMaterialRhiShader::updateUniformData().
float QSGMaterialShader::RenderState::determinant | ( | ) | const |
Returns the modelview determinant to be used for rendering.
Definition at line 759 of file qsgmaterialshader.cpp.
float QSGMaterialShader::RenderState::devicePixelRatio | ( | ) | const |
Returns the ratio between physical pixels and device-independent pixels to be used for rendering.
Definition at line 778 of file qsgmaterialshader.cpp.
QRect QSGMaterialShader::RenderState::deviceRect | ( | ) | const |
Returns the device rect of the surface being rendered to.
Definition at line 825 of file qsgmaterialshader.cpp.
References deviceRect, m_data, and Q_ASSERT.
|
inline |
Returns which rendering states that have changed and needs to be updated for geometry rendered with this material to conform to the current rendering state.
Definition at line 36 of file qsgmaterialshader.h.
|
inline |
Returns true
if the dirtyStates() contain the dirty matrix state, otherwise returns false
.
Definition at line 38 of file qsgmaterialshader.h.
References DirtyMatrix.
Referenced by TabledMaterialRhiShader::updateUniformData(), DeformableMaterialRhiShader::updateUniformData(), ParticleSpriteMaterialRhiShader::updateUniformData(), ColoredPointMaterialRhiShader::updateUniformData(), and SimplePointMaterialRhiShader::updateUniformData().
|
inline |
Returns true
if the dirtyStates() contains the dirty opacity state, otherwise returns false
.
Definition at line 39 of file qsgmaterialshader.h.
References DirtyOpacity.
Referenced by TabledMaterialRhiShader::updateUniformData(), DeformableMaterialRhiShader::updateUniformData(), ParticleSpriteMaterialRhiShader::updateUniformData(), ColoredPointMaterialRhiShader::updateUniformData(), and SimplePointMaterialRhiShader::updateUniformData().
QMatrix4x4 QSGMaterialShader::RenderState::modelViewMatrix | ( | ) | const |
Returns the model view matrix.
If the material has the RequiresFullMatrix flag set, this is guaranteed to be the complete transform matrix calculated from the scenegraph.
However, if this flag is not set, the renderer may choose to alter this matrix. For example, it may pre-transform vertices on the CPU and set this matrix to identity.
In a situation such as the above, it is still possible to retrieve the actual matrix determinant by setting the RequiresDeterminant flag in the material and calling the determinant() accessor.
Definition at line 798 of file qsgmaterialshader.cpp.
float QSGMaterialShader::RenderState::opacity | ( | ) | const |
\variable QSGMaterialShader::GraphicsPipelineState::blendEnable
Enables blending.
\variable QSGMaterialShader::GraphicsPipelineState::srcColor
Source blending factor, either RGB or RGBA depending on separateBlendFactors.
\variable QSGMaterialShader::GraphicsPipelineState::dstColor
Destination blending factor, either RGB or RGBA depending on separateBlendFactors.
\variable QSGMaterialShader::GraphicsPipelineState::colorWrite
Color write mask.
\variable QSGMaterialShader::GraphicsPipelineState::blendConstant
Blend constant applicable when a blending factor is set to use a constant value.
\variable QSGMaterialShader::GraphicsPipelineState::cullMode
Cull mode.
\variable QSGMaterialShader::GraphicsPipelineState::polygonMode
Polygon rasterization mode.
\variable QSGMaterialShader::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.
\variable QSGMaterialShader::GraphicsPipelineState::srcAlpha
Source alpha blending factor.
Applies only when separateBlendFactors is set to true.
\variable QSGMaterialShader::GraphicsPipelineState::dstAlpha
Destination alpha blending factor.
Applies only when separateBlendFactors is set to true.
Returns the accumulated opacity to be used for rendering.
Definition at line 750 of file qsgmaterialshader.cpp.
References Q_ASSERT.
Referenced by TabledMaterialRhiShader::updateUniformData(), DeformableMaterialRhiShader::updateUniformData(), ParticleSpriteMaterialRhiShader::updateUniformData(), ColoredPointMaterialRhiShader::updateUniformData(), and SimplePointMaterialRhiShader::updateUniformData().
QMatrix4x4 QSGMaterialShader::RenderState::projectionMatrix | ( | ) | const |
Returns the projection matrix.
Definition at line 807 of file qsgmaterialshader.cpp.
QRhiResourceUpdateBatch * QSGMaterialShader::RenderState::resourceUpdateBatch | ( | ) |
Returns a resource update batch to which upload and copy operatoins can be queued.
This is typically used by QSGMaterialShader::updateSampledImage() to enqueue texture image content updates.
Definition at line 863 of file qsgmaterialshader.cpp.
References m_data, and Q_ASSERT.
Referenced by TabledMaterialRhiShader::updateSampledImage(), DeformableMaterialRhiShader::updateSampledImage(), ParticleSpriteMaterialRhiShader::updateSampledImage(), ColoredPointMaterialRhiShader::updateSampledImage(), and SimplePointMaterialRhiShader::updateSampledImage().
QRhi * QSGMaterialShader::RenderState::rhi | ( | ) |
Returns the current QRhi.
Definition at line 872 of file qsgmaterialshader.cpp.
References m_data, and Q_ASSERT.
Referenced by TabledMaterialRhiShader::updateSampledImage(), DeformableMaterialRhiShader::updateSampledImage(), ParticleSpriteMaterialRhiShader::updateSampledImage(), ColoredPointMaterialRhiShader::updateSampledImage(), and SimplePointMaterialRhiShader::updateSampledImage().
QByteArray * QSGMaterialShader::RenderState::uniformData | ( | ) |
Returns a pointer to the data for the uniform (constant) buffer in the shader.
Uniform data must only be updated from QSGMaterialShader::updateUniformData(). The return value is null in the other reimplementable functions, such as, QSGMaterialShader::updateSampledImage().
std140
in the shader, and to carefully study the standard uniform block layout as described in section 7.6.2.2 of the OpenGL specification. It is up to the QSGMaterialShader implementation to ensure data gets placed at the right location in this QByteArray, taking alignment requirements into account. Shader code translated to other shading languages is expected to use the same offsets for block members, even when the target language uses different packing rules by default.Definition at line 851 of file qsgmaterialshader.cpp.
References m_data, and Q_ASSERT.
Referenced by TabledMaterialRhiShader::updateUniformData(), DeformableMaterialRhiShader::updateUniformData(), ParticleSpriteMaterialRhiShader::updateUniformData(), ColoredPointMaterialRhiShader::updateUniformData(), and SimplePointMaterialRhiShader::updateUniformData().
QRect QSGMaterialShader::RenderState::viewportRect | ( | ) | const |
Returns the viewport rect of the surface being rendered to.
Definition at line 816 of file qsgmaterialshader.cpp.
|
friend |
Definition at line 55 of file qsgmaterialshader.h.