summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-01 13:57:38 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-01 13:57:38 (GMT)
commit5067683704580fcfedef4e68f19acedb133936e8 (patch)
tree9ed5acfa397b093fd726742ae3c478c2f21223bc /src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
parent1b4bb02fcb3da77ddfa6281365ba3210aab9daad (diff)
parent11d2c8f96697adc93ccd82e3db1de6ecde025eff (diff)
downloadQt-5067683704580fcfedef4e68f19acedb133936e8.zip
Qt-5067683704580fcfedef4e68f19acedb133936e8.tar.gz
Qt-5067683704580fcfedef4e68f19acedb133936e8.tar.bz2
Merge branch 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (160 commits) audiodevices example: no devices available Assistant: Fix unintended tr context change. Add QFontMetrics benchmark. Fixed `make test' for xmlpatternsxqts. Doc: Put the correct images with the D-Bus and Embedded Linux sections. Call cheaper clear() instead of assigning new QString() Fix a regression: icons with slightly wrong ICO header did not load. Fix some foreach usage to use const refs Designer: Fix source code scanning issues. googlesuggest example: Add newline to end of file Core classes, examples, demos: Some changes from string to char Fix header labels on mac with rtl Fixed an endless loop if printing web pages. doc: Fixed the last qdoc errors. don't build unneeded QtDesigner parts on Windows CE doc: Document the "Type" enum value as a const in variable. Add additional text and painting benchmarks. Better support for user-generated binary shaders don't falsely complain about mismatched codecfortr Fix QSettings default paths not being initialized when setPath() is called ...
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 5e41cc1..24560d1 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -169,12 +169,6 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
if (matrixDirty)
updateMatrix();
-
- if (simpleShaderMatrixUniformDirty) {
- const GLuint location = shaderManager->simpleProgram()->uniformLocation("pmvMatrix");
- glUniformMatrix3fv(location, 1, GL_FALSE, (GLfloat*)pmvMatrix);
- simpleShaderMatrixUniformDirty = false;
- }
}
void QGL2PaintEngineExPrivate::updateBrushTexture()
@@ -393,9 +387,11 @@ void QGL2PaintEngineExPrivate::updateMatrix()
matrixDirty = false;
- // The actual data has been updated so both shader program's uniforms need updating
- simpleShaderMatrixUniformDirty = true;
- shaderMatrixUniformDirty = true;
+ // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only
+ // need to do this once for every matrix change and persists across all shader programs.
+ glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]);
+ glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]);
+ glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]);
dasher.setInvScale(inverseScale);
stroker.setInvScale(inverseScale);
@@ -1033,18 +1029,12 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
if (changed) {
// The shader program has changed so mark all uniforms as dirty:
brushUniformsDirty = true;
- shaderMatrixUniformDirty = true;
opacityUniformDirty = true;
}
if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode)
updateBrushUniforms();
- if (shaderMatrixUniformDirty) {
- glUniformMatrix3fv(location(QGLEngineShaderManager::PmvMatrix), 1, GL_FALSE, (GLfloat*)pmvMatrix);
- shaderMatrixUniformDirty = false;
- }
-
if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) {
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity);
opacityUniformDirty = false;
@@ -2060,11 +2050,8 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state == s || old_state->renderHintsChanged)
renderHintsChanged();
- if (old_state == s || old_state->matrixChanged) {
+ if (old_state == s || old_state->matrixChanged)
d->matrixDirty = true;
- d->simpleShaderMatrixUniformDirty = true;
- d->shaderMatrixUniformDirty = true;
- }
if (old_state == s || old_state->compositionModeChanged)
d->compositionModeDirty = true;