diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-12-08 15:31:37 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2014-12-12 22:37:00 +0100 |
commit | 37490d465b203ac109f422b482eda9704f4e8593 (patch) | |
tree | 6c6b150e68f184e87631e983b4be3cf016ff3f1b /src/gui/opengl/qopenglpaintengine_p.h | |
parent | adfeb9e44479c16945409bb9d45d5720524a8c98 (diff) |
GL: Make updateTexture invalidate texture on change of texture unit
Switching texture units means the value of lastTextureUsed could be
invalid, meaning we need to unconditionally re-bind and update parameters.
A future optimization would be to keep a per-texture-unit cache, so
that we wouldn't have to re-bind and set parameters when switching
units back and forth, but this complicates the current code somewhat,
so it's left for another patch.
Change-Id: Icb2a5d03457a907f3c25bbb437feeb7c5f155716
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl/qopenglpaintengine_p.h')
-rw-r--r-- | src/gui/opengl/qopenglpaintengine_p.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h index 209cd3d7b5..297ac54640 100644 --- a/src/gui/opengl/qopenglpaintengine_p.h +++ b/src/gui/opengl/qopenglpaintengine_p.h @@ -69,6 +69,8 @@ enum EngineMode { QT_BEGIN_NAMESPACE #define GL_STENCIL_HIGH_BIT GLuint(0x80) +#define QT_UNKNOWN_TEXTURE_UNIT GLuint(-1) +#define QT_DEFAULT_TEXTURE_UNIT GLuint(0) #define QT_BRUSH_TEXTURE_UNIT GLuint(0) #define QT_IMAGE_TEXTURE_UNIT GLuint(0) //Can be the same as brush texture unit #define QT_MASK_TEXTURE_UNIT GLuint(1) @@ -184,6 +186,7 @@ public: snapToPixelGrid(false), nativePaintingActive(false), inverseScale(1), + lastTextureUnitUsed(QT_UNKNOWN_TEXTURE_UNIT), lastMaskTextureUsed(0) { } @@ -199,6 +202,7 @@ public: void updateTexture(GLenum textureUnit, const T &texture, GLenum wrapMode, GLenum filterMode, TextureUpdateMode updateMode = UpdateIfNeeded); template<typename T> GLuint bindTexture(const T &texture); + void activateTextureUnit(GLenum textureUnit); void resetGLState(); @@ -300,6 +304,7 @@ public: GLfloat pmvMatrix[3][3]; GLfloat inverseScale; + GLenum lastTextureUnitUsed; GLuint lastTextureUsed; GLuint lastMaskTextureUsed; |