summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Caches.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/Caches.cpp')
-rw-r--r--libs/hwui/Caches.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index f0f72f9..e443294 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -68,6 +68,7 @@ void Caches::init() {
mCurrentBuffer = meshBuffer;
mCurrentIndicesBuffer = 0;
mCurrentPositionPointer = this;
+ mCurrentPositionStride = 0;
mCurrentTexCoordsPointer = this;
mTexCoordsArrayEnabled = false;
@@ -86,6 +87,8 @@ void Caches::init() {
lastDstMode = GL_ZERO;
currentProgram = NULL;
+ mFunctorsCount = 0;
+
mInitialized = true;
}
@@ -340,15 +343,18 @@ bool Caches::unbindIndicesBuffer() {
// Meshes and textures
///////////////////////////////////////////////////////////////////////////////
-void Caches::bindPositionVertexPointer(bool force, GLuint slot, GLvoid* vertices, GLsizei stride) {
- if (force || vertices != mCurrentPositionPointer) {
+void Caches::bindPositionVertexPointer(bool force, GLvoid* vertices, GLsizei stride) {
+ if (force || vertices != mCurrentPositionPointer || stride != mCurrentPositionStride) {
+ GLuint slot = currentProgram->position;
glVertexAttribPointer(slot, 2, GL_FLOAT, GL_FALSE, stride, vertices);
mCurrentPositionPointer = vertices;
+ mCurrentPositionStride = stride;
}
}
-void Caches::bindTexCoordsVertexPointer(bool force, GLuint slot, GLvoid* vertices) {
+void Caches::bindTexCoordsVertexPointer(bool force, GLvoid* vertices) {
if (force || vertices != mCurrentTexCoordsPointer) {
+ GLuint slot = currentProgram->texCoords;
glVertexAttribPointer(slot, 2, GL_FLOAT, GL_FALSE, gMeshStride, vertices);
mCurrentTexCoordsPointer = vertices;
}
@@ -454,6 +460,22 @@ void Caches::endTiling() {
}
}
+bool Caches::hasRegisteredFunctors() {
+ return mFunctorsCount > 0;
+}
+
+void Caches::registerFunctors(uint32_t functorCount) {
+ mFunctorsCount += functorCount;
+}
+
+void Caches::unregisterFunctors(uint32_t functorCount) {
+ if (functorCount > mFunctorsCount) {
+ mFunctorsCount = 0;
+ } else {
+ mFunctorsCount -= functorCount;
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// Regions
///////////////////////////////////////////////////////////////////////////////