diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-04-22 15:38:02 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-04-22 15:41:49 (GMT) |
commit | 873aa5cb7542497dd4e98bcc145b479f32343b5e (patch) | |
tree | a081eace82a85d8c79fb0c2af5fb428558aa1ee2 /src/opengl/gl2paintengineex | |
parent | 0df382c78aeaf74c161d753f04ae9a13e951c0a1 (diff) | |
download | Qt-873aa5cb7542497dd4e98bcc145b479f32343b5e.zip Qt-873aa5cb7542497dd4e98bcc145b479f32343b5e.tar.gz Qt-873aa5cb7542497dd4e98bcc145b479f32343b5e.tar.bz2 |
Make useCorrectShaderProg() return a bool again
Returns true if it had to change the shader program so the engine knows
it needs to clean the uniforms.
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 16 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 3 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 |
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; |