diff options
Diffstat (limited to 'src/quick/scenegraph/util/qsgvertexcolormaterial.cpp')
-rw-r--r-- | src/quick/scenegraph/util/qsgvertexcolormaterial.cpp | 64 |
1 files changed, 3 insertions, 61 deletions
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index c27dd7d1f0..9f2836d6aa 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -38,64 +38,10 @@ ****************************************************************************/ #include "qsgvertexcolormaterial.h" -#if QT_CONFIG(opengl) -# include <qopenglshaderprogram.h> -#endif -QT_BEGIN_NAMESPACE - -class QSGVertexColorMaterialShader : public QSGMaterialShader -{ -public: - QSGVertexColorMaterialShader(); - - void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; - char const *const *attributeNames() const override; - -private: - void initialize() override; -#if QT_CONFIG(opengl) - int m_matrix_id; - int m_opacity_id; -#endif -}; - -QSGVertexColorMaterialShader::QSGVertexColorMaterialShader() -{ -#if QT_CONFIG(opengl) - setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.vert")); - setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.frag")); -#endif -} - -void QSGVertexColorMaterialShader::updateState(const RenderState &state, QSGMaterial * /*newEffect*/, QSGMaterial *) -{ -#if QT_CONFIG(opengl) - if (state.isOpacityDirty()) - program()->setUniformValue(m_opacity_id, state.opacity()); - - if (state.isMatrixDirty()) - program()->setUniformValue(m_matrix_id, state.combinedMatrix()); -#else - Q_UNUSED(state) -#endif -} - -char const *const *QSGVertexColorMaterialShader::attributeNames() const -{ - static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr }; - return attr; -} - -void QSGVertexColorMaterialShader::initialize() -{ -#if QT_CONFIG(opengl) - m_matrix_id = program()->uniformLocation("matrix"); - m_opacity_id = program()->uniformLocation("opacity"); -#endif -} +QT_BEGIN_NAMESPACE -class QSGVertexColorMaterialRhiShader : public QSGMaterialRhiShader +class QSGVertexColorMaterialRhiShader : public QSGMaterialShader { public: QSGVertexColorMaterialRhiShader(); @@ -168,7 +114,6 @@ bool QSGVertexColorMaterialRhiShader::updateUniformData(RenderState &state, QSGVertexColorMaterial::QSGVertexColorMaterial() { setFlag(Blending, true); - setFlag(SupportsRhiShader, true); } @@ -204,10 +149,7 @@ QSGMaterialType *QSGVertexColorMaterial::type() const QSGMaterialShader *QSGVertexColorMaterial::createShader() const { - if (flags().testFlag(RhiShaderWanted)) - return new QSGVertexColorMaterialRhiShader; - else - return new QSGVertexColorMaterialShader; + return new QSGVertexColorMaterialRhiShader; } QT_END_NAMESPACE |