From 117bdbcfa3e8306dad21e7e01fa71b00cdfa7265 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Thu, 5 Feb 2015 10:12:38 -0800 Subject: Glop ColorFilter & VertexBuffer support, initial enable Enables Glop rendering for supported Rects and VertexBuffers Also removes unused Query object Change-Id: Ibe227bc362685a153159f75077664f0947764e06 --- libs/hwui/renderstate/MeshState.cpp | 48 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'libs/hwui/renderstate/MeshState.cpp') diff --git a/libs/hwui/renderstate/MeshState.cpp b/libs/hwui/renderstate/MeshState.cpp index 50c09c8..ce6030d 100644 --- a/libs/hwui/renderstate/MeshState.cpp +++ b/libs/hwui/renderstate/MeshState.cpp @@ -23,22 +23,20 @@ namespace android { namespace uirenderer { MeshState::MeshState() - : mCurrentPositionPointer(this) + : mCurrentIndicesBuffer(0) + , mCurrentPixelBuffer(0) + , mCurrentPositionPointer(this) , mCurrentPositionStride(0) , mCurrentTexCoordsPointer(this) , mCurrentTexCoordsStride(0) - , mTexCoordsArrayEnabled(false) { + , mTexCoordsArrayEnabled(false) + , mQuadListIndices(0) { glGenBuffers(1, &mUnitQuadBuffer); glBindBuffer(GL_ARRAY_BUFFER, mUnitQuadBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(kUnitQuadVertices), kUnitQuadVertices, GL_STATIC_DRAW); mCurrentBuffer = mUnitQuadBuffer; - mCurrentIndicesBuffer = 0; - mCurrentPixelBuffer = 0; - - mQuadListIndices = 0; - mShadowStripsIndices = 0; // position attribute always enabled glEnableVertexAttribArray(Program::kBindingPosition); @@ -50,9 +48,10 @@ MeshState::~MeshState() { glDeleteBuffers(1, &mQuadListIndices); mQuadListIndices = 0; +} - glDeleteBuffers(1, &mShadowStripsIndices); - mShadowStripsIndices = 0; +void MeshState::dump() { + ALOGD("MeshState vertices: unitQuad %d, current %d", mUnitQuadBuffer, mCurrentBuffer); } /////////////////////////////////////////////////////////////////////////////// @@ -65,18 +64,17 @@ bool MeshState::bindMeshBuffer() { bool MeshState::bindMeshBuffer(GLuint buffer) { if (!buffer) buffer = mUnitQuadBuffer; - if (mCurrentBuffer != buffer) { - glBindBuffer(GL_ARRAY_BUFFER, buffer); - mCurrentBuffer = buffer; - return true; - } - return false; + return bindMeshBufferInternal(buffer); } bool MeshState::unbindMeshBuffer() { - if (mCurrentBuffer) { - glBindBuffer(GL_ARRAY_BUFFER, 0); - mCurrentBuffer = 0; + return bindMeshBufferInternal(0); +} + +bool MeshState::bindMeshBufferInternal(GLuint buffer) { + if (mCurrentBuffer != buffer) { + glBindBuffer(GL_ARRAY_BUFFER, buffer); + mCurrentBuffer = buffer; return true; } return false; @@ -163,20 +161,6 @@ bool MeshState::bindQuadIndicesBuffer() { return bindIndicesBufferInternal(mQuadListIndices); } -bool MeshState::bindShadowIndicesBuffer() { - if (!mShadowStripsIndices) { - std::unique_ptr shadowIndices(new uint16_t[MAX_SHADOW_INDEX_COUNT]); - ShadowTessellator::generateShadowIndices(shadowIndices.get()); - glGenBuffers(1, &mShadowStripsIndices); - bool force = bindIndicesBufferInternal(mShadowStripsIndices); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, MAX_SHADOW_INDEX_COUNT * sizeof(uint16_t), - shadowIndices.get(), GL_STATIC_DRAW); - return force; - } - - return bindIndicesBufferInternal(mShadowStripsIndices); -} - bool MeshState::unbindIndicesBuffer() { if (mCurrentIndicesBuffer) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); -- cgit v1.1