From 260e102162322958cf17dbd895cd6bd30dc87e32 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 12 Jul 2010 14:41:06 -0700 Subject: 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 --- libs/hwui/Program.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libs/hwui/Program.cpp') 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]); } -- cgit v1.2.3-59-g8ed1b