summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-06-24 08:43:30 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-06-24 10:33:01 (GMT)
commitbd08e5dc4bd4c14511838717daa5dc1b7c748746 (patch)
treee8427a58091f5e842cbd40d465f4738f76670d4f /src/opengl/gl2paintengineex/qglengineshadermanager_p.h
parent2d0bcd161299db2b01fd9a6427058af1c0d3b407 (diff)
downloadQt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.zip
Qt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.tar.gz
Qt-bd08e5dc4bd4c14511838717daa5dc1b7c748746.tar.bz2
Reduced number of state changes/uniform location queries in GL2 engine.
Keep track of uniform locations for the current shader program in the shader manager. Also don't change texture parameters unless necessary. Reviewed-by: Kim
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadermanager_p.h')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 9013884..34f0768 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -237,6 +237,8 @@ struct QGLEngineShaderProg
QGLShader* maskFragShader; // Can be null for no mask
QGLShader* compositionFragShader; // Can be null for GL-handled mode
QGLShaderProgram* program;
+
+ QVector<uint> uniformLocations;
};
/*
@@ -283,6 +285,9 @@ public:
void setMaskType(MaskType);
void setCompositionMode(QPainter::CompositionMode);
+ uint getUniformIdentifier(const char *uniformName);
+ uint getUniformLocation(uint id);
+
void setDirty(); // someone has manually changed the current shader program
bool useCorrectShaderProg(); // returns true if the shader program needed to be changed
@@ -374,9 +379,9 @@ private:
bool useTextureCoords;
QPainter::CompositionMode compositionMode;
- QGLShaderProgram* blitShaderProg;
- QGLShaderProgram* simpleShaderProg;
- QGLShaderProgram* currentShaderProg;
+ QGLShaderProgram* blitShaderProg;
+ QGLShaderProgram* simpleShaderProg;
+ QGLEngineShaderProg* currentShaderProg;
// TODO: Possibly convert to a LUT
QList<QGLEngineShaderProg> cachedPrograms;
@@ -386,6 +391,8 @@ private:
void compileNamedShader(QGLEngineShaderManager::ShaderName name, QGLShader::ShaderType type);
static const char* qglEngineShaderSourceCode[TotalShaderCount];
+
+ QVector<const char *> uniformIdentifiers;
};
QT_END_NAMESPACE