diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-24 08:43:30 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-24 10:33:01 (GMT) |
commit | bd08e5dc4bd4c14511838717daa5dc1b7c748746 (patch) | |
tree | e8427a58091f5e842cbd40d465f4738f76670d4f /src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | |
parent | 2d0bcd161299db2b01fd9a6427058af1c0d3b407 (diff) | |
download | Qt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.zip Qt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.tar.gz Qt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.tar.bz2 |
Reduced number of state changes/uniform location queries in GL2 engine.
Keep track of uniform locations for the current shader program in the
shader manager. Also don't change texture parameters unless necessary.
Reviewed-by: Kim
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index a2a44c0..448964b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -156,7 +156,7 @@ public: void updateBrushUniforms(); void updateMatrix(); void updateCompositionMode(); - void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform); + void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id = -1); void setBrush(const QBrush* brush); @@ -175,7 +175,8 @@ public: void fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill); // ^ Calls drawVertexArrays to render into stencil buffer - void prepareForDraw(bool srcPixelsAreOpaque); + bool prepareForDraw(bool srcPixelsAreOpaque); + // ^ returns whether the current program changed or not inline void useSimpleShader(); inline QColor premultiplyColor(QColor c, GLfloat opacity); @@ -198,6 +199,7 @@ public: bool stencilBufferDirty; bool depthUniformDirty; bool simpleShaderDepthUniformDirty; + bool opacityUniformDirty; const QBrush* currentBrush; // May not be the state's brush! @@ -218,6 +220,34 @@ public: void regenerateDepthClip(); void systemStateChanged(); uint use_system_clip : 1; + + enum Uniform { + ImageTexture, + PatternColor, + GlobalOpacity, + Depth, + PmvMatrix, + MaskTexture, + FragmentColor, + LinearData, + Angle, + HalfViewportSize, + Fmp, + Fmp2MRadius2, + Inverse2Fmp2MRadius2, + InvertedTextureSize, + BrushTransform, + BrushTexture, + NumUniforms + }; + + uint location(Uniform uniform) + { + return shaderManager->getUniformLocation(uniformIdentifiers[uniform]); + } + + uint uniformIdentifiers[NumUniforms]; + GLuint lastTexture; }; QT_END_NAMESPACE |