diff options
author | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
commit | 220871a697290529278ed16db508eda8e12f3fc7 (patch) | |
tree | bc13101b63c6fe39a9d92706ecb7ded7f98f5a9c /libs/hwui/renderstate/RenderState.cpp | |
parent | 802f191b2b84a1b1b82c7f6f3268846084b35dfb (diff) | |
parent | 98e12851336b7db16e583f9afac63ecc97465980 (diff) |
Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.
Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
Diffstat (limited to 'libs/hwui/renderstate/RenderState.cpp')
-rw-r--r-- | libs/hwui/renderstate/RenderState.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp index 2c92924cc12c..5fc5cb275741 100644 --- a/libs/hwui/renderstate/RenderState.cpp +++ b/libs/hwui/renderstate/RenderState.cpp @@ -53,6 +53,11 @@ void RenderState::onGLContextCreated() { mScissor = new Scissor(); mStencil = new Stencil(); + // Deferred because creation needs GL context for texture limits + if (!mLayerPool) { + mLayerPool = new OffscreenBufferPool(); + } + // This is delayed because the first access of Caches makes GL calls if (!mCaches) { mCaches = &Caches::createInstance(*this); @@ -67,7 +72,7 @@ static void layerLostGlContext(Layer* layer) { } void RenderState::onGLContextDestroyed() { - mLayerPool.clear(); + mLayerPool->clear(); // TODO: reset all cached state in state objects std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerLostGlContext); @@ -100,7 +105,7 @@ static void layerDestroyedVkContext(Layer* layer) { } void RenderState::onVkContextDestroyed() { - mLayerPool.clear(); + mLayerPool->clear(); std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerDestroyedVkContext); GpuMemoryTracker::onGpuContextDestroyed(); } @@ -116,10 +121,10 @@ void RenderState::flush(Caches::FlushMode mode) { case Caches::FlushMode::Moderate: // fall through case Caches::FlushMode::Layers: - mLayerPool.clear(); + if (mLayerPool) mLayerPool->clear(); break; } - mCaches->flush(mode); + if (mCaches) mCaches->flush(mode); } void RenderState::onBitmapDestroyed(uint32_t pixelRefId) { @@ -257,7 +262,8 @@ void RenderState::postDecStrong(VirtualLightRefBase* object) { // Render /////////////////////////////////////////////////////////////////////////////// -void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { +void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix, + bool overrideDisableBlending) { const Glop::Mesh& mesh = glop.mesh; const Glop::Mesh::Vertices& vertices = mesh.vertices; const Glop::Mesh::Indices& indices = mesh.indices; @@ -412,7 +418,11 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) { // ------------------------------------ // ---------- GL state setup ---------- // ------------------------------------ - blend().setFactors(glop.blend.src, glop.blend.dst); + if (CC_UNLIKELY(overrideDisableBlending)) { + blend().setFactors(GL_ZERO, GL_ZERO); + } else { + blend().setFactors(glop.blend.src, glop.blend.dst); + } GL_CHECKPOINT(MODERATE); |