Use LUT for computing final shadow alpha
bug:27415250
Significantly reduces shadow fragment shader computation.
Change-Id: Ie9b3c712700754b3734d0ae9cda8751c298fc59e
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index ea4391b..e78cd72 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -298,7 +298,8 @@
// indices
meshState().bindIndicesBuffer(indices.bufferObject);
- if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
+ // texture
+ if (fill.texture.texture != nullptr) {
const Glop::Fill::TextureData& texture = fill.texture;
// texture always takes slot 0, shader samplers increment from there
mCaches->textureState().activateTexture(0);
@@ -311,13 +312,16 @@
texture.texture->setFilter(texture.filter, false, false, texture.target);
}
- meshState().enableTexCoordsVertexArray();
- meshState().bindTexCoordsVertexPointer(vertices.texCoord, vertices.stride);
-
if (texture.textureTransform) {
glUniformMatrix4fv(fill.program->getUniform("mainTextureTransform"), 1,
GL_FALSE, &texture.textureTransform->data[0]);
}
+ }
+
+ // vertex attributes (tex coord, color, alpha)
+ if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
+ meshState().enableTexCoordsVertexArray();
+ meshState().bindTexCoordsVertexPointer(vertices.texCoord, vertices.stride);
} else {
meshState().disableTexCoordsVertexArray();
}