diff options
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadermanager_p.h')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 9d881cc..69574ba 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -199,23 +199,23 @@ O = Global Opacity - CUSTOM SHADER CODE (idea, depricated) + CUSTOM SHADER CODE ================== The use of custom shader code is supported by the engine for drawImage and drawPixmap calls. This is implemented via hooks in the fragment pipeline. + The custom shader is passed to the engine as a partial fragment shader (QGLCustomShaderStage). The shader will implement a pre-defined method name which Qt's fragment pipeline will call: - lowp vec4 customShader() - - Depending on the custom type, the custom shader has a small API it can use - to read pixels. The basic custom type is for image/pixmap drawing and thus - can use the following to sample the src texture (non-premultiplied) + lowp vec4 customShader(sampler2d src, vec2 srcCoords) - lowp vec4 QSampleSrcPixel(mediump vec2 coords) + The provided src and srcCoords parameters can be used to sample from the + source image. + Transformations, clipping, opacity, and composition modes set using QPainter + will be respected when using the custom shader hook. */ #ifndef QGLENGINE_SHADER_MANAGER_H @@ -233,7 +233,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) - struct QGLEngineShaderProg { QGLShader* mainVertexShader; @@ -276,7 +275,7 @@ struct QGLEngineCachedShaderProg static const GLuint QT_VERTEX_COORDS_ATTR = 0; static const GLuint QT_TEXTURE_COORDS_ATTR = 1; -class QGLEngineShaderManager : public QObject +class Q_OPENGL_EXPORT QGLEngineShaderManager : public QObject { Q_OBJECT public: @@ -362,6 +361,7 @@ public: MainFragmentShader, ImageSrcFragmentShader, + CustomSrcFragmentShader, ImageSrcWithPatternFragmentShader, NonPremultipliedImageSrcFragmentShader, CustomImageSrcFragmentShader, @@ -408,7 +408,6 @@ public: Q_ENUMS(ShaderName) #endif - private: QGLContext* ctx; bool shaderProgNeedsChanging; @@ -421,12 +420,13 @@ private: bool useTextureCoords; QPainter::CompositionMode compositionMode; QGLCustomShaderStage* customSrcStage; - QGLCustomShaderStage* customSrcStagePrev; QGLShaderProgram* blitShaderProg; QGLShaderProgram* simpleShaderProg; QGLEngineShaderProg* currentShaderProg; + QCache<QByteArray, QGLShader> customShaderCache; + // TODO: Possibly convert to a LUT QList<QGLEngineShaderProg> cachedPrograms; |