diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-02-18 19:54:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-21 06:39:34 +0100 |
commit | c6c95915f076577d5194044d793889cb8b690230 (patch) | |
tree | 2d4d3d7968358c209f356ddcbb930f3d2f5e135f /src/quick/scenegraph/util/qsgatlastexture.cpp | |
parent | f158fa7feaa5d9fc2ae17aa16853acbbb947443a (diff) |
Make sure we update filtering options on atlas textures.
We had had an optimization which tried to reduce state changes,
but filtering is also changed in QSGTexture::updateBindOptions
which Atlas::bind() didn't know anything about. Solution: don't
try to be so clever.
Task-number: QTBUG-35457
Change-Id: I39ac0106396921e1b652db2b2aa5a9923b35e825
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/scenegraph/util/qsgatlastexture.cpp')
-rw-r--r-- | src/quick/scenegraph/util/qsgatlastexture.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index fe659c9add..333bc62143 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -140,7 +140,6 @@ Atlas::Atlas(const QSize &size) : m_allocator(size) , m_texture_id(0) , m_size(size) - , m_filtering(QSGTexture::Linear) , m_allocated(false) { @@ -315,9 +314,8 @@ void Atlas::uploadBgra(Texture *texture) } -bool Atlas::bind(QSGTexture::Filtering filtering) +void Atlas::bind(QSGTexture::Filtering filtering) { - bool forceUpdate = false; if (!m_allocated) { m_allocated = true; @@ -362,13 +360,12 @@ bool Atlas::bind(QSGTexture::Filtering filtering) glDeleteTextures(1, &m_texture_id); m_texture_id = 0; } - forceUpdate = true; } else { glBindTexture(GL_TEXTURE_2D, m_texture_id); } if (m_texture_id == 0) - return false; + return; // Upload all pending images.. for (int i=0; i<m_pending_uploads.size(); ++i) { @@ -403,16 +400,11 @@ bool Atlas::bind(QSGTexture::Filtering filtering) #endif } - if (filtering != m_filtering) { - GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, f); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, f); - m_filtering = filtering; - } + GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, f); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, f); m_pending_uploads.clear(); - - return forceUpdate; } void Atlas::remove(Texture *t) |