summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-07-28 10:25:55 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-07-28 12:19:18 (GMT)
commitdbdc54791e585f3c6bf62c1a091ef844a66483ba (patch)
tree75b5f14c4b1a8176b53b23d93f0b6f7dcc688365 /src/opengl/gl2paintengineex/qglengineshadermanager_p.h
parent610aa1737a206fe97628a3375a543400ea0761fa (diff)
parent0431548ddffc56f74cc60e7d341ade3920adefb1 (diff)
downloadQt-dbdc54791e585f3c6bf62c1a091ef844a66483ba.zip
Qt-dbdc54791e585f3c6bf62c1a091ef844a66483ba.tar.gz
Qt-dbdc54791e585f3c6bf62c1a091ef844a66483ba.tar.bz2
Merge commit 'qt-graphics-team/pixmapfilters-redux' into kinetic-graphicseffect
Conflicts: src/opengl/gl2paintengineex/qglengineshadermanager.cpp src/opengl/gl2paintengineex/qglengineshadermanager_p.h src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h Merge custom shader / GL blur pixmap filter implementation from graphics team repo with implementation from kinetic graphics-team repo.
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadermanager_p.h')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h22
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;