diff options
author | Fred Fettinger <fred.fettinger@motorola.com> | 2014-08-29 14:02:31 -0500 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-09-09 20:00:52 +0000 |
commit | 70735bd5ddd6ba3063d5537f510324cb2515aba6 (patch) | |
tree | dab6e5ebc8d098c1e75dc5f1922237fe799bdb80 /libs/hwui/Caches.h | |
parent | 95e71085e2d6f9482679a2a5c34d3d7fbc7d39c6 (diff) | |
download | frameworks_base-70735bd5ddd6ba3063d5537f510324cb2515aba6.zip frameworks_base-70735bd5ddd6ba3063d5537f510324cb2515aba6.tar.gz frameworks_base-70735bd5ddd6ba3063d5537f510324cb2515aba6.tar.bz2 |
hwui: Caches: use mBoundTextures only for GL_TEXTURE_2D
bug:17441218
GLConsumer uses glBindTexture() directly instead of going through
Caches::bindTexture(). This can cause libhwui to draw with the wrong
texture bound in the following case which involves 2 TextureViews:
Frame 1:
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 1)
HWUI renders TextureView A:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 1) and draws
Frame 2:
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 1)
GLConsumer::updateTexImage() calls glBindTexture(GL_TEXTURE_EXTERNAL_OES, 2)
HWUI renders TextureView A:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 1) and draws
HWUI renders TextureView B:
calls Caches::bindTexture(GL_TEXTURE_EXTERNAL_OES, 2) and draws
In this case, HWUI will incorrectly draw TextureView A using texture 2 on
frame 2, because mBoundTextures[0]=1, even though the texture currently
bound to GL_TEXTURE_EXTERNAL_OES is 2.
Since GLConsumer is always used with a target of GL_TEXTURE_EXTERNAL_OES,
work around this problem by having mBoundTextures[] store only the
textures bound to the target GL_TEXTURE_2D. This is the common case
where the extra performance is needed. Since it's legal to have
different textures bound to GL_TEXTURE_2D and GL_TEXTURE_EXTERNAL_OES
on one texture unit, Caches::bindTexture() does not need to clear
mBoundTextures[mTextureUnit] when target != GL_TEXTURE_2D.
Change-Id: I8bc54ab8adcfacad7f3ed17a31236dc7a86c967a
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
Diffstat (limited to 'libs/hwui/Caches.h')
-rw-r--r-- | libs/hwui/Caches.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h index 726b74d..7aa628c 100644 --- a/libs/hwui/Caches.h +++ b/libs/hwui/Caches.h @@ -431,6 +431,7 @@ private: uint32_t mFunctorsCount; + // Caches texture bindings for the GL_TEXTURE_2D target GLuint mBoundTextures[REQUIRED_TEXTURE_UNITS_COUNT]; OverdrawColorSet mOverdrawDebugColorSet; |