summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp16
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h3
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp4
3 files changed, 10 insertions, 13 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 6e702e5..3d8d34b 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -210,11 +210,6 @@ void QGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode)
shaderProgNeedsChanging = true; //###
}
-bool QGLEngineShaderManager::shaderProgramDirty()
-{
- return shaderProgNeedsChanging;
-}
-
QGLShaderProgram* QGLEngineShaderManager::currentProgram()
{
return currentShaderProg;
@@ -228,9 +223,13 @@ QGLShaderProgram* QGLEngineShaderManager::simpleProgram()
-// Select & use the correct shader program using the current state
-void QGLEngineShaderManager::useCorrectShaderProg()
+// Select & use the correct shader program using the current state.
+// Returns true if program needed changing.
+bool QGLEngineShaderManager::useCorrectShaderProg()
{
+ if (!shaderProgNeedsChanging)
+ return false;
+
QGLEngineShaderProg requiredProgram;
requiredProgram.program = 0;
@@ -400,7 +399,7 @@ void QGLEngineShaderManager::useCorrectShaderProg()
currentShaderProg = prog.program;
currentShaderProg->enable();
shaderProgNeedsChanging = false;
- return;
+ return true;
}
}
@@ -442,6 +441,7 @@ void QGLEngineShaderManager::useCorrectShaderProg()
currentShaderProg->enable();
}
shaderProgNeedsChanging = false;
+ return true;
}
void QGLEngineShaderManager::compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type)
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index d3856fe..e9e261f 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -279,8 +279,7 @@ public:
void setMaskType(MaskType);
void setCompositionMode(QPainter::CompositionMode);
- bool shaderProgramDirty(); // returns true if the shader program needs to be changed
- void useCorrectShaderProg();
+ bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen
QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 5a701aa..7dbdc32 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -741,9 +741,7 @@ void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
// If the shader program needs changing, we change it and mark all uniforms as dirty
- if (shaderManager->shaderProgramDirty()) {
- shaderManager->useCorrectShaderProg();
-
+ if (shaderManager->useCorrectShaderProg()) {
// The shader program has changed so mark all uniforms as dirty:
brushUniformsDirty = true;
shaderMatrixUniformDirty = true;