Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader Class Reference
+ Inheritance diagram for QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader:
+ Collaboration diagram for QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader:

Public Member Functions

 QSGCurveFillMaterialShader (QGradient::Type gradientType, bool useDerivatives, int viewCount)
 
bool updateUniformData (RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override
 This function is called by the scene graph to get the contents of the shader program's uniform buffer updated.
 
void updateSampledImage (RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
 This function is called by the scene graph to prepare use of sampled images in the shader, typically in the form of combined image samplers.
 
- Public Member Functions inherited from QSGMaterialShader
 QSGMaterialShader ()
 Constructs a new QSGMaterialShader.
 
virtual ~QSGMaterialShader ()
 
virtual bool updateGraphicsPipelineState (RenderState &state, GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
 This function is called by the scene graph to enable the material to provide a custom set of graphics state.
 
Flags flags () const
 
void setFlag (Flags flags, bool on=true)
 Sets the flags on this material shader if on is true; otherwise clears the specified flags.
 
void setFlags (Flags flags)
 Sets the flags for this material shader.
 
int combinedImageSamplerCount (int binding) const
 Returns the number of elements in the combined image sampler variable at binding.
 

Additional Inherited Members

- Public Types inherited from QSGMaterialShader
enum  Flag { UpdatesGraphicsPipelineState = 0x0001 }
 Flag values to indicate special material properties. More...
 
enum  Stage { VertexStage , FragmentStage }
 
- Protected Member Functions inherited from QSGMaterialShader
 QSGMaterialShader (QSGMaterialShaderPrivate &dd)
 
void setShaderFileName (Stage stage, const QString &filename)
 Sets the filename for the shader for the specified stage.
 
void setShaderFileName (Stage stage, const QString &filename, int viewCount)
 Sets the filename for the shader for the specified stage.
 
void setShader (Stage stage, const QShader &shader)
 Sets the shader for the specified stage.
 

Detailed Description

Definition at line 14 of file qsgcurvefillnode_p.cpp.

Constructor & Destructor Documentation

◆ QSGCurveFillMaterialShader()

QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader::QSGCurveFillMaterialShader ( QGradient::Type gradientType,
bool useDerivatives,
int viewCount )

Member Function Documentation

◆ updateSampledImage()

void QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader::updateSampledImage ( RenderState & state,
int binding,
QSGTexture ** texture,
QSGMaterial * newMaterial,
QSGMaterial * oldMaterial )
overridevirtual

This function is called by the scene graph to prepare use of sampled images in the shader, typically in the form of combined image samplers.

binding is the binding number of the sampler. The function is called for each combined image sampler variable in the shader code associated with the QSGMaterialShader.

{texture} is an array of QSGTexture pointers. The number of elements in the array matches the number of elements in the image sampler variable specified in the shader code. This variable may be an array, and may have more than one dimension. The number of elements in the array may be found via \l{QSGMaterialShader::combinedImageSamplerCount}

When an element in {texture} is null, it must be set to a valid QSGTexture pointer before returning. When non-null, it is up to the material to decide if a new {QSGTexture *} is stored to it, or if it updates some parameters on the already known QSGTexture. The ownership of the QSGTexture is not transferred.

The current rendering state is passed from the scene graph. Where relevant, it is up to the material to trigger enqueuing texture data uploads via QSGTexture::commitTextureOperations().

The subclass specific state can be extracted from newMaterial.

oldMaterial can be used to minimize changes. When oldMaterial is null, this shader was just activated.

See also
QSGMaterialShader::combinedImageSamplerCount

Reimplemented from QSGMaterialShader.

Definition at line 47 of file qsgcurvefillnode_p.cpp.

References QSGGradientCache::cacheForRhi(), cacheKey(), QSGCurveFillNode::fillGradient(), QSGCurveFillNode::gradientType(), QGradient::NoGradient, Q_UNUSED, QSGGradientCache::GradientDesc::spread, state, and QSGGradientCache::GradientDesc::stops.

+ Here is the call graph for this function:

◆ updateUniformData()

bool QT_BEGIN_NAMESPACE::QSGCurveFillMaterialShader::updateUniformData ( RenderState & state,
QSGMaterial * newMaterial,
QSGMaterial * oldMaterial )
overridevirtual

This function is called by the scene graph to get the contents of the shader program's uniform buffer updated.

The implementation is not expected to perform any real graphics operations, it is merely responsible for copying data to the QByteArray returned from RenderState::uniformData(). The scene graph takes care of making that buffer visible in the shaders.

The current rendering state is passed from the scene graph. If the state indicates that any relevant state is dirty, the implementation must update the appropriate region in the buffer data that is accessible via RenderState::uniformData(). When a state, such as, matrix or opacity, is not dirty, there is no need to touch the corresponding region since the data is persistent.

The return value must be true whenever any change was made to the uniform data.

The subclass specific state, such as the color of a flat color material, should be extracted from newMaterial to update the relevant regions in the buffer accordingly.

oldMaterial can be used to minimize buffer changes (which are typically memcpy calls) when updating material states. When oldMaterial is null, this shader was just activated.

Reimplemented from QSGMaterialShader.

Definition at line 63 of file qsgcurvefillnode_p.cpp.

References QSGGradientCache::GradientDesc::a, QColor::alphaF(), QSGGradientCache::GradientDesc::b, QColor::blueF(), QSGCurveFillNode::color(), QGradient::ConicalGradient, debug, QSGCurveFillNode::debug(), QSGCurveFillNode::fillGradient(), QSGCurveFillNode::gradientType(), QColor::greenF(), QGradient::LinearGradient, QGradient::NoGradient, Q_ASSERT, qAbs(), qDegreesToRadians(), qFuzzyCompare(), qMin(), qSqrt(), QGradient::RadialGradient, QColor::redF(), state, QSGGradientCache::GradientDesc::v0, and QSGGradientCache::GradientDesc::v1.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: