4#ifndef QSGRHISHADEREFFECTNODE_P_H
5#define QSGRHISHADEREFFECTNODE_P_H
18#include <private/qsgadaptationlayer_p.h>
19#include <qsgmaterial.h>
24class QSGDefaultRenderContext;
32 void reset(
const QShader &vs,
const QShader &fs);
34 void feedConstants(
const QSGShaderEffectNode::ShaderData &shader,
const QSet<
int> *dirtyIndices =
nullptr);
35 void feedSamplers(
const QSGShaderEffectNode::ShaderData &shader,
const QSet<
int> *dirtyIndices =
nullptr);
45 return size == other.size && specialType == other.specialType
46 && (specialType == QSGShaderEffectNode::VariableData::None ? value == other.value :
true);
67 int compare(
const QSGMaterial *other)
const override;
73 bool usesSubRectUniform(
int binding)
const {
return m_linker.m_subRectBindings.contains(binding); }
107 void handleTextureProviderDestroyed(QObject *object);
119 void prepareShaderCode(ShaderInfo::Type typeHint,
const QUrl &src, ShaderInfo *result)
override;
122 bool reflect(ShaderInfo *result);
124 QFileSelector *m_fileSelector =
nullptr;
QString log() const override
void prepareShaderCode(ShaderInfo::Type typeHint, const QUrl &src, ShaderInfo *result) override
Status status() const override
bool hasSeparateSamplerAndTextureObjects() const override
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,...
QSGRhiShaderEffectMaterialShader(const QSGRhiShaderEffectMaterial *material)
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to enable the material to provide a custom set of graphics...
QSGRhiShaderLinker m_linker
QVector< QSGTextureProvider * > m_textureProviders
bool m_hasCustomFragmentShader
static const int MAX_BINDINGS
QSGMaterialType * m_materialType
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
~QSGRhiShaderEffectMaterial()
QSGRhiShaderEffectMaterial(QSGRhiShaderEffectNode *node)
bool usesSubRectUniform(int binding) const
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGRhiShaderEffectNode * m_node
void * m_materialTypeCacheKey
QSGPlainTexture * m_dummyTexture
QSGShaderEffectNode::CullMode m_cullMode
void updateTextureProviders(bool layoutChange)
bool m_geometryUsesTextureSubRect
bool m_hasCustomVertexShader
void preprocess() override
Override this function to do processing on the node before it is rendered.
static void garbageCollectMaterialTypeCache(void *materialTypeCacheKey)
QRectF updateNormalizedTextureSubRect(bool supportsAtlasTextures) override
void syncMaterial(SyncData *syncData) override
static void resetMaterialTypeCache(void *materialTypeCacheKey)
void feedSamplers(const QSGShaderEffectNode::ShaderData &shader, const QSet< int > *dirtyIndices=nullptr)
QHash< QByteArray, int > m_samplerNameMap
void reset(const QShader &vs, const QShader &fs)
QHash< uint, Constant > m_constants
void linkTextureSubRects()
QSet< int > m_subRectBindings
QHash< int, QVariant > m_samplers
void feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet< int > *dirtyIndices=nullptr)
static void fillUniformBlockMember(char *dst, const T *value, int valueCount, int fieldSizeBytes)
static QShader loadShaderFromFile(const QString &filename)
size_t qHash(const QSGRhiShaderMaterialTypeCache::Key &key, size_t seed=0)
static QHash< void *, QSGRhiShaderMaterialTypeCache > shaderMaterialTypeCache
static QColor qsg_premultiply_color(const QColor &c)
static QMutex shaderMaterialTypeCacheMutex
static bool hasAtlasTexture(const QVector< QSGTextureProvider * > &textureProviders)
QDebug operator<<(QDebug debug, const QSGRhiShaderLinker::Constant &c)
quint32 matrixArrayByteSize
static QSGRhiShaderEffectDefaultShader create(const QString &filename, int viewCount)
QSGShaderEffectNode::VariableData::SpecialType specialType
bool operator==(const Constant &other) const
bool operator==(const Key &other) const
Key(const QShader &vs, const QShader &fs)
void unref(const QShader &vs, const QShader &fs)
QSGMaterialType * ref(const QShader &vs, const QShader &fs)
QHash< Key, QSGMaterialType * > m_graveyard
QHash< Key, MaterialType > m_types