diff options
author | Chris Craik <ccraik@google.com> | 2016-04-28 16:59:42 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2016-05-03 14:36:29 -0700 |
commit | 138c21fbec12bead3c7ca1f181c3fd35542ccb00 (patch) | |
tree | 44e5b182b83c2532dd02f1ccb6d9c9186a48c4cf /libs/hwui/renderstate/RenderState.cpp | |
parent | 08ca2e3a7593ced4967c56709a1fe675408d42dc (diff) |
Use LUT for computing final shadow alpha
bug:27415250
Significantly reduces shadow fragment shader computation.
Change-Id: Ie9b3c712700754b3734d0ae9cda8751c298fc59e
Diffstat (limited to 'libs/hwui/renderstate/RenderState.cpp')
-rw-r--r-- | libs/hwui/renderstate/RenderState.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp index ea4391b87006..e78cd7296f42 100644 --- a/libs/hwui/renderstate/RenderState.cpp +++ b/libs/hwui/renderstate/RenderState.cpp @@ -298,7 +298,8 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { // 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 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { 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(); } |