summaryrefslogtreecommitdiff
path: root/libs/hwui/Program.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-07-12 14:41:06 -0700
committerRomain Guy <romainguy@google.com>2010-07-12 14:43:40 -0700
commit260e102162322958cf17dbd895cd6bd30dc87e32 (patch)
treee7ff653e0e68525f1f90edeb2fbccc88fb81caeb /libs/hwui/Program.cpp
parentd12315ae7ee06902f4b7470259ce33076b6f542c (diff)
Optimize shader binding changes.
This change also cleans up the internal API a little bit by using mat4 everywhere instead of float[16] (for the ortho matrix for instance.) Change-Id: I35924c7dc17bad17f30307118d5ed437c2ed37e0
Diffstat (limited to 'libs/hwui/Program.cpp')
-rw-r--r--libs/hwui/Program.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index 98d254cc9fdb..3b5e5da0ad18 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -59,6 +59,8 @@ Program::Program(const char* vertex, const char* fragment) {
}
glDeleteProgram(id);
}
+
+ mUse = false;
}
Program::~Program() {
@@ -69,6 +71,11 @@ Program::~Program() {
void Program::use() {
glUseProgram(id);
+ mUse = true;
+}
+
+void Program::remove() {
+ mUse = false;
}
int Program::addAttrib(const char* name) {
@@ -130,13 +137,12 @@ void DrawColorProgram::getAttribsAndUniforms() {
transform = addUniform("transform");
}
-void DrawColorProgram::use(const float* projectionMatrix, const mat4& modelViewMatrix,
+void DrawColorProgram::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
const mat4& transformMatrix) {
mat4 t(projectionMatrix);
t.multiply(transformMatrix);
t.multiply(modelViewMatrix);
- Program::use();
glUniformMatrix4fv(transform, 1, GL_FALSE, &t.data[0]);
}