Encapsulate textures into their own Texture class
the main reason for doing this is so that we can have
access to informations about a texture (like its dimension)
close to where we generate and use shaders in ES 2.0.
Previously, there wasn't any way to get to a texture's size
from a RenderEngine implementation.
Bug: 8679321
Change-Id: I388b338a70d07e3e8177dde248710ea1e4c82dff
diff --git a/services/surfaceflinger/RenderEngine/Description.cpp b/services/surfaceflinger/RenderEngine/Description.cpp
index 9611b02..8e404b2 100644
--- a/services/surfaceflinger/RenderEngine/Description.cpp
+++ b/services/surfaceflinger/RenderEngine/Description.cpp
@@ -31,12 +31,11 @@
mPlaneAlpha = 1.0f;
mPremultipliedAlpha = true;
mOpaque = true;
- mTextureTarget = GL_TEXTURE_EXTERNAL_OES;
+ mTextureEnabled = false;
const GLfloat m[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
memset(mColor, 0, sizeof(mColor));
memcpy(mProjectionMatrix, m, sizeof(mProjectionMatrix));
- memcpy(mTextureMatrix, m, sizeof(mTextureMatrix));
}
Description::~Description() {
@@ -61,21 +60,14 @@
}
}
-void Description::setTextureName(GLenum target, GLuint tname) {
- if (target != mTextureTarget) {
- mTextureTarget = target;
- }
- if (tname != mTextureName) {
- mTextureName = tname;
- mUniformsDirty = true;
- }
+void Description::setTexture(const Texture& texture) {
+ mTexture = texture;
+ mTextureEnabled = true;
+ mUniformsDirty = true;
}
void Description::disableTexture() {
- if (mTextureTarget != 0) {
- mTextureTarget = 0;
- }
- mTextureName = 0;
+ mTextureEnabled = false;
}
void Description::setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
@@ -91,9 +83,4 @@
mUniformsDirty = true;
}
-void Description::setTextureMatrix(GLfloat const* mtx) {
- memcpy(mTextureMatrix, mtx, sizeof(mTextureMatrix));
- mUniformsDirty = true;
-}
-
} /* namespace android */