summaryrefslogtreecommitdiff
path: root/libs/surfaceflinger/TextureManager.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2010-06-28 20:01:58 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-06-28 20:01:58 -0700
commitf0562b4b071b74a760ad9c9caa0e41687ae6f407 (patch)
tree7727eecba3edba2862dd90174a3348028dab83fe /libs/surfaceflinger/TextureManager.cpp
parent31e0ffe8444b70500cac319da084c4c45e62aca2 (diff)
parent8fa4c811e6d0da82282f9db1a32706399ee538bc (diff)
Merge changes I93dfc4c8,I781953d6 into gingerbread
* changes: fix[2798925] Gingerbread TOT not booting Revert "Revert "fix [2793164] Spam 2x/second with TOT master in SurfaceFlinger""
Diffstat (limited to 'libs/surfaceflinger/TextureManager.cpp')
-rw-r--r--libs/surfaceflinger/TextureManager.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/libs/surfaceflinger/TextureManager.cpp b/libs/surfaceflinger/TextureManager.cpp
index d9bdc6acec34..fa192563cb4b 100644
--- a/libs/surfaceflinger/TextureManager.cpp
+++ b/libs/surfaceflinger/TextureManager.cpp
@@ -30,14 +30,15 @@
#include "clz.h"
#include "DisplayHardware/DisplayHardware.h"
+#include "GLExtensions.h"
#include "TextureManager.h"
namespace android {
// ---------------------------------------------------------------------------
-TextureManager::TextureManager(uint32_t flags)
- : mFlags(flags)
+TextureManager::TextureManager()
+ : mGLExtensions(GLExtensions::getInstance())
{
}
@@ -85,9 +86,11 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format)
GLenum target = GL_TEXTURE_2D;
#if defined(GL_OES_texture_external)
- if (format && isSupportedYuvFormat(format)) {
- target = GL_TEXTURE_EXTERNAL_OES;
- pImage->target = Texture::TEXTURE_EXTERNAL;
+ if (GLExtensions::getInstance().haveTextureExternal()) {
+ if (format && isSupportedYuvFormat(format)) {
+ target = GL_TEXTURE_EXTERNAL_OES;
+ pImage->target = Texture::TEXTURE_EXTERNAL;
+ }
}
#endif
@@ -208,7 +211,7 @@ status_t TextureManager::loadTexture(Texture* texture,
/*
* round to POT if needed
*/
- if (!(mFlags & DisplayHardware::NPOT_EXTENSION)) {
+ if (!mGLExtensions.haveNpot()) {
texture->NPOTAdjust = true;
}
@@ -294,17 +297,19 @@ status_t TextureManager::loadTexture(Texture* texture,
void TextureManager::activateTexture(const Texture& texture, bool filter)
{
const GLenum target = getTextureTarget(&texture);
-
- glBindTexture(target, texture.name);
- glEnable(target);
-
+ if (target == GL_TEXTURE_2D) {
+ glBindTexture(GL_TEXTURE_2D, texture.name);
+ glEnable(GL_TEXTURE_2D);
#if defined(GL_OES_texture_external)
- if (texture.target == Texture::TEXTURE_2D) {
- glDisable(GL_TEXTURE_EXTERNAL_OES);
+ if (GLExtensions::getInstance().haveTextureExternal()) {
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ }
} else {
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture.name);
+ glEnable(GL_TEXTURE_EXTERNAL_OES);
glDisable(GL_TEXTURE_2D);
- }
#endif
+ }
if (filter) {
glTexParameterx(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -319,7 +324,9 @@ void TextureManager::deactivateTextures()
{
glDisable(GL_TEXTURE_2D);
#if defined(GL_OES_texture_external)
- glDisable(GL_TEXTURE_EXTERNAL_OES);
+ if (GLExtensions::getInstance().haveTextureExternal()) {
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ }
#endif
}