diff options
Diffstat (limited to 'libs/surfaceflinger/TextureManager.cpp')
-rw-r--r-- | libs/surfaceflinger/TextureManager.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/libs/surfaceflinger/TextureManager.cpp b/libs/surfaceflinger/TextureManager.cpp index e4dd42fd5f3e..d9bdc6acec34 100644 --- a/libs/surfaceflinger/TextureManager.cpp +++ b/libs/surfaceflinger/TextureManager.cpp @@ -30,15 +30,14 @@ #include "clz.h" #include "DisplayHardware/DisplayHardware.h" -#include "GLExtensions.h" #include "TextureManager.h" namespace android { // --------------------------------------------------------------------------- -TextureManager::TextureManager() - : mGLExtensions(GLExtensions::getInstance()) +TextureManager::TextureManager(uint32_t flags) + : mFlags(flags) { } @@ -86,11 +85,9 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format) GLenum target = GL_TEXTURE_2D; #if defined(GL_OES_texture_external) - if (GLExtensions::getInstance().haveTextureExternal()) { - if (format && isSupportedYuvFormat(format)) { - target = GL_TEXTURE_EXTERNAL_OES; - pImage->target = Texture::TEXTURE_EXTERNAL; - } + if (format && isSupportedYuvFormat(format)) { + target = GL_TEXTURE_EXTERNAL_OES; + pImage->target = Texture::TEXTURE_EXTERNAL; } #endif @@ -211,7 +208,7 @@ status_t TextureManager::loadTexture(Texture* texture, /* * round to POT if needed */ - if (!mGLExtensions.haveNpot()) { + if (!(mFlags & DisplayHardware::NPOT_EXTENSION)) { texture->NPOTAdjust = true; } @@ -297,19 +294,14 @@ status_t TextureManager::loadTexture(Texture* texture, void TextureManager::activateTexture(const Texture& texture, bool filter) { const GLenum target = getTextureTarget(&texture); - if (target == Texture::TEXTURE_2D) { - glBindTexture(GL_TEXTURE_2D, texture.name); - glEnable(GL_TEXTURE_2D); -#if defined(GL_OES_texture_external) - if (GLExtensions::getInstance().haveTextureExternal()) { - glDisable(GL_TEXTURE_EXTERNAL_OES); - } -#endif - } + + glBindTexture(target, texture.name); + glEnable(target); + #if defined(GL_OES_texture_external) - else { - glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture.name); - glEnable(GL_TEXTURE_EXTERNAL_OES); + if (texture.target == Texture::TEXTURE_2D) { + glDisable(GL_TEXTURE_EXTERNAL_OES); + } else { glDisable(GL_TEXTURE_2D); } #endif @@ -327,9 +319,7 @@ void TextureManager::deactivateTextures() { glDisable(GL_TEXTURE_2D); #if defined(GL_OES_texture_external) - if (GLExtensions::getInstance().haveTextureExternal()) { - glDisable(GL_TEXTURE_EXTERNAL_OES); - } + glDisable(GL_TEXTURE_EXTERNAL_OES); #endif } |