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
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index 61d55a9..652befe1 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -46,6 +46,20 @@
*/
void use();
+ /**
+ * Marks this program as unused. This will not unbind
+ * the program from the GL context.
+ */
+ void remove();
+
+ /**
+ * Indicates whether this program is currently in use with
+ * the GL context.
+ */
+ inline bool isInUse() const {
+ return mUse;
+ }
+
protected:
/**
* Adds an attribute with the specified name.
@@ -87,6 +101,8 @@
// Keeps track of attributes and uniforms slots
KeyedVector<const char*, int> attributes;
KeyedVector<const char*, int> uniforms;
+
+ bool mUse;
}; // class Program
/**
@@ -109,7 +125,7 @@
* Binds the program with the specified projection, modelView and
* transform matrices.
*/
- void use(const float* projectionMatrix, const mat4& modelViewMatrix,
+ void set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
const mat4& transformMatrix);
/**