diff options
author | Romain Guy <romainguy@google.com> | 2013-06-04 18:00:09 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-06-04 18:58:36 -0700 |
commit | 8aa195d7081b889f3a7b1f426cbd8556377aae5e (patch) | |
tree | 6cd0ab4181c25d3113c4e39b49e8f8a0c7d12b8b /libs/hwui/Caches.h | |
parent | 84f3c5689cffbfc1e45a0101d5bb636323769f54 (diff) | |
download | frameworks_base-8aa195d7081b889f3a7b1f426cbd8556377aae5e.zip frameworks_base-8aa195d7081b889f3a7b1f426cbd8556377aae5e.tar.gz frameworks_base-8aa195d7081b889f3a7b1f426cbd8556377aae5e.tar.bz2 |
Introduce Caches::bindTexture() to reduce glBindTexture calls
Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
Diffstat (limited to 'libs/hwui/Caches.h')
-rw-r--r-- | libs/hwui/Caches.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h index 54e4138..bd31ec3 100644 --- a/libs/hwui/Caches.h +++ b/libs/hwui/Caches.h @@ -55,6 +55,7 @@ namespace uirenderer { // Globals /////////////////////////////////////////////////////////////////////////////// +// GL ES 2.0 defines that at least 16 texture units must be supported #define REQUIRED_TEXTURE_UNITS_COUNT 3 #define REGION_MESH_QUAD_COUNT 512 @@ -79,6 +80,7 @@ static const GLsizei gVertexAAWidthOffset = 2 * sizeof(float); static const GLsizei gVertexAALengthOffset = 3 * sizeof(float); static const GLsizei gMeshCount = 4; +// Must define as many texture units as specified by REQUIRED_TEXTURE_UNITS_COUNT static const GLenum gTextureUnits[] = { GL_TEXTURE0, GL_TEXTURE1, @@ -223,6 +225,22 @@ public: void activeTexture(GLuint textureUnit); /** + * Binds the specified texture as a GL_TEXTURE_2D texture. + */ + void bindTexture(GLuint texture); + + /** + * Binds the specified texture.. + */ + void bindTexture(GLenum target, GLuint texture); + + /** + * Signals that the cache of bound textures should be cleared. + * Other users of the context may have altered which textures are bound. + */ + void resetBoundTextures(); + + /** * Sets the scissor for the current surface. */ bool setScissor(GLint x, GLint y, GLint width, GLint height); @@ -363,6 +381,8 @@ private: bool mInitialized; uint32_t mFunctorsCount; + + GLuint mBoundTextures[REQUIRED_TEXTURE_UNITS_COUNT]; }; // class Caches }; // namespace uirenderer |