Glop layer mesh rendering
Change-Id: I2d902819d5d77f496b67d4d25a298782903e410d
diff --git a/libs/hwui/renderstate/MeshState.cpp b/libs/hwui/renderstate/MeshState.cpp
index 585fb86..6b00020 100644
--- a/libs/hwui/renderstate/MeshState.cpp
+++ b/libs/hwui/renderstate/MeshState.cpp
@@ -68,6 +68,7 @@
void MeshState::dump() {
ALOGD("MeshState VBOs: unitQuad %d, current %d", mUnitQuadBuffer, mCurrentBuffer);
+ ALOGD("MeshState IBOs: quadList %d, current %d", mQuadListIndices, mCurrentIndicesBuffer);
ALOGD("MeshState vertices: vertex data %p, stride %d",
mCurrentPositionPointer, mCurrentPositionStride);
ALOGD("MeshState texCoord: data %p, stride %d",
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index b64dbdc..192bf81 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -253,7 +253,6 @@
glUniform1f(fill.program->getUniform("roundRectRadius"),
roundedOutRadius);
}
-
// --------------------------------
// ---------- Mesh setup ----------
// --------------------------------
@@ -269,16 +268,16 @@
// glop.fill.texture always takes slot 0, shader samplers increment from there
mCaches->textureState().activateTexture(0);
- if (glop.fill.textureClamp != GL_INVALID_ENUM) {
- glop.fill.texture->setWrap(glop.fill.textureClamp, true);
+ if (glop.fill.texture.clamp != GL_INVALID_ENUM) {
+ glop.fill.texture.texture->setWrap(glop.fill.texture.clamp, true);
}
- if (glop.fill.textureFilter != GL_INVALID_ENUM) {
- glop.fill.texture->setFilter(glop.fill.textureFilter, true);
+ if (glop.fill.texture.filter != GL_INVALID_ENUM) {
+ glop.fill.texture.texture->setFilter(glop.fill.texture.filter, true);
}
- mCaches->textureState().bindTexture(fill.texture->id);
+ mCaches->textureState().bindTexture(fill.texture.texture->id);
meshState().enableTexCoordsVertexArray();
- meshState().bindTexCoordsVertexPointer(force, mesh.texCoordOffset);
+ meshState().bindTexCoordsVertexPointer(force, mesh.texCoordOffset, mesh.stride);
} else {
meshState().disableTexCoordsVertexArray();
}
@@ -313,8 +312,13 @@
while (elementsCount > 0) {
GLsizei drawCount = MathUtils::min(elementsCount, (GLsizei) kMaxNumberOfQuads * 6);
- // TODO: this double binds on first pass
- meshState().bindPositionVertexPointer(true, vertices, mesh.stride);
+ // rebind pointers without forcing, since initial bind handled above
+ meshState().bindPositionVertexPointer(false, vertices, mesh.stride);
+ if (mesh.vertexFlags & kTextureCoord_Attrib) {
+ meshState().bindTexCoordsVertexPointer(false,
+ vertices + kMeshTextureOffset, mesh.stride);
+ }
+
glDrawElements(mesh.primitiveMode, drawCount, GL_UNSIGNED_SHORT, nullptr);
elementsCount -= drawCount;
vertices += (drawCount / 6) * 4 * mesh.stride;
diff --git a/libs/hwui/renderstate/TextureState.cpp b/libs/hwui/renderstate/TextureState.cpp
index 1a638d2..a211de7 100644
--- a/libs/hwui/renderstate/TextureState.cpp
+++ b/libs/hwui/renderstate/TextureState.cpp
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <renderstate/TextureState.h>
+#include "renderstate/TextureState.h"
namespace android {
namespace uirenderer {