From d202681aa857cce2468c95676a56c9133a8f226c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 16 Mar 2010 15:56:15 +0100 Subject: Avoid using uncompatible vertex shader for non-solid brushes The simplified vertex shader for complex geometry is written specifically for solid brushes and needs to be disabled when the brush is anything else. This work-around can be removed later when QTBUG-9069 is handled, since that removes the extra requirements on the setPosition() shader. Reviewed-by: tom --- src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index aa704b1..ac25597 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -328,7 +328,7 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS newProg->program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); if (newProg->useOpacityAttribute) newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); - if (newProg->usePmvMatrix) { + if (newProg->usePmvMatrixAttribute) { newProg->program->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); newProg->program->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); newProg->program->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); @@ -753,9 +753,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg() } requiredProgram.useTextureCoords = texCoords; requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity); - requiredProgram.usePmvMatrix = true; - if (complexGeometry) + if (complexGeometry && srcPixelType == Qt::SolidPattern) { requiredProgram.positionVertexShader = QGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader; + requiredProgram.usePmvMatrixAttribute = false; + } else { + requiredProgram.usePmvMatrixAttribute = true; + + // Force complexGeometry off, since we currently don't support that mode for + // non-solid brushes + complexGeometry = false; + } // At this point, requiredProgram is fully populated so try to find the program in the cache currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); -- cgit v0.12