summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2014-01-29 13:00:33 -0800
committer Chris Craik <ccraik@google.com> 2014-01-29 13:04:33 -0800
commitd04a6b15f74035fd2068f34225825b55e94521f4 (patch)
treeb3f2d439202281d5d5680154a969df8ae1907a13
parentc0877962b3dc49edb42aeda766593123c81613f1 (diff)
Fix projection offset caching
Because the caching of projection matrix didn't account for changes in the offset flag, the flag could be ignored. Now we use both to verify that the cached matrix can be used. Change-Id: I193b94eaf0b98f046a6484f0866c3d25048653fd
-rw-r--r--libs/hwui/Program.cpp3
-rw-r--r--libs/hwui/Program.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index a679552aa757..ee7789755609 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -163,7 +163,7 @@ GLuint Program::buildShader(const char* source, GLenum type) {
void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
const mat4& transformMatrix, bool offset) {
- if (projectionMatrix != mProjection) {
+ if (projectionMatrix != mProjection || offset != mOffset) {
if (CC_LIKELY(!offset)) {
glUniformMatrix4fv(projection, 1, GL_FALSE, &projectionMatrix.data[0]);
} else {
@@ -177,6 +177,7 @@ void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
glUniformMatrix4fv(projection, 1, GL_FALSE, &p.data[0]);
}
mProjection = projectionMatrix;
+ mOffset = offset;
}
mat4 t(transformMatrix);
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index bc0f2114d203..5dfb2fa5a37d 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -431,6 +431,7 @@ private:
bool mHasSampler;
mat4 mProjection;
+ bool mOffset;
}; // class Program
}; // namespace uirenderer