summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-16 11:23:51 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-16 12:35:15 (GMT)
commitc066afa4bc95ac92185e9fc691b9d9d27ca64387 (patch)
tree73ad6740f2033039da92b39e596f5159ab948da3 /src/opengl/gl2paintengineex/qglengineshadermanager.cpp
parente0dd5b450e1b04feb6c72a3c635c586b244392da (diff)
downloadQt-c066afa4bc95ac92185e9fc691b9d9d27ca64387.zip
Qt-c066afa4bc95ac92185e9fc691b9d9d27ca64387.tar.gz
Qt-c066afa4bc95ac92185e9fc691b9d9d27ca64387.tar.bz2
Implement a special case, simplified vertex shader for complex geometry
When drawing text, the vertex count will most likely be so high that using a uniform-based, simpler vertex shader is faster. We implement the ability to inform the shader manager that the geometry is considered complex, so that it can choose the simpler vertex shader in these cases. Task-number: QT-2887 Reviewed-by: tom
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadermanager.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 8183f08..aa704b1 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -96,6 +96,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context)
code[UntransformedPositionVertexShader] = qglslUntransformedPositionVertexShader;
code[PositionOnlyVertexShader] = qglslPositionOnlyVertexShader;
+ code[ComplexGeometryPositionOnlyVertexShader] = qglslComplexGeometryPositionOnlyVertexShader;
code[PositionWithPatternBrushVertexShader] = qglslPositionWithPatternBrushVertexShader;
code[PositionWithLinearGradientBrushVertexShader] = qglslPositionWithLinearGradientBrushVertexShader;
code[PositionWithConicalGradientBrushVertexShader] = qglslPositionWithConicalGradientBrushVertexShader;
@@ -401,6 +402,7 @@ void QGLEngineSharedShaders::cleanupCustomStage(QGLCustomShaderStage* stage)
QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
: ctx(context),
shaderProgNeedsChanging(true),
+ complexGeometry(false),
srcPixelType(Qt::NoBrush),
opacityMode(NoOpacity),
maskType(NoMask),
@@ -442,7 +444,8 @@ GLuint QGLEngineShaderManager::getUniformLocation(Uniform id)
"inverse_2_fmp2_m_radius2",
"invertedTextureSize",
"brushTransform",
- "brushTexture"
+ "brushTexture",
+ "matrix"
};
if (uniformLocations.at(id) == GLuint(-1))
@@ -751,6 +754,8 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
requiredProgram.useTextureCoords = texCoords;
requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
requiredProgram.usePmvMatrix = true;
+ if (complexGeometry)
+ requiredProgram.positionVertexShader = QGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;
// At this point, requiredProgram is fully populated so try to find the program in the cache
currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);