From: Heeyong Song Date: Wed, 31 Jan 2018 04:46:29 +0000 (+0900) Subject: [4.0] Discard render instruction if it is empty X-Git-Tag: accepted/tizen/4.0/unified/20180205.144538~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=3f144756eeb5e99e23ec61e6d4902932397da6b8 [4.0] Discard render instruction if it is empty Change-Id: Iac0c55ca381c9a04a1467bf42656da8cd7416fce --- diff --git a/dali/internal/render/common/render-instruction-container.cpp b/dali/internal/render/common/render-instruction-container.cpp index 3cbff8a..9b16af8 100644 --- a/dali/internal/render/common/render-instruction-container.cpp +++ b/dali/internal/render/common/render-instruction-container.cpp @@ -80,6 +80,10 @@ RenderInstruction& RenderInstructionContainer::At( BufferIndex bufferIndex, size return *mInstructions[ bufferIndex ][ index ]; } +void RenderInstructionContainer::DiscardCurrentInstruction( BufferIndex bufferIndex ) +{ + mIndex[ bufferIndex ]--; +} } // namespace SceneGraph diff --git a/dali/internal/render/common/render-instruction-container.h b/dali/internal/render/common/render-instruction-container.h index 1bcff8b..9181243 100644 --- a/dali/internal/render/common/render-instruction-container.h +++ b/dali/internal/render/common/render-instruction-container.h @@ -76,6 +76,12 @@ public: */ RenderInstruction& At( BufferIndex bufferIndex, size_t index ); + /** + * Discard the current container index + * @param bufferIndex to reset + */ + void DiscardCurrentInstruction( BufferIndex bufferIndex ); + private: unsigned int mIndex[ 2 ]; ///< count of the elements that have been added diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 9261a6d..712d268 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -472,8 +472,6 @@ void RenderManager::Render( Integration::RenderStatus& status ) GLenum attachments[] = { GL_DEPTH, GL_STENCIL }; mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments); - mImpl->UpdateTrackers(); - //Notify RenderGeometries that rendering has finished for ( auto&& iter : mImpl->geometryContainer ) { @@ -481,6 +479,8 @@ void RenderManager::Render( Integration::RenderStatus& status ) } } + mImpl->UpdateTrackers(); + // If this frame was rendered due to instructions existing, we mark this so we know to clear the next frame. mImpl->lastFrameWasRendered = haveInstructions; diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index b4035e8..b95706f 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -400,6 +400,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, RenderInstruction& instruction = instructions.GetNextInstruction( updateBufferIndex ); renderTask.PrepareRenderInstruction( instruction, updateBufferIndex ); bool viewMatrixHasNotChanged = !renderTask.ViewMatrixUpdated(); + bool isRenderListAdded = false; const Matrix& viewMatrix = renderTask.GetViewMatrix( updateBufferIndex ); SceneGraph::Camera& camera = renderTask.GetCamera(); @@ -430,6 +431,8 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, // We only use the clipping version of the sort comparitor if any clipping nodes exist within the RenderList. SortRenderItems( updateBufferIndex, *renderList, layer, hasClippingNodes ); } + + isRenderListAdded = true; } if( !layer.overlayRenderables.Empty() ) @@ -450,13 +453,19 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, // Clipping hierarchy is irrelevant when sorting overlay items, so we specify using the non-clipping version of the sort comparitor. SortRenderItems( updateBufferIndex, *renderList, layer, false ); } + + isRenderListAdded = true; } } // Inform the render instruction that all renderers have been added and this frame is complete. instruction.UpdateCompleted(); -} + if( !isRenderListAdded && !instruction.mIsClearColorSet ) + { + instructions.DiscardCurrentInstruction( updateBufferIndex ); + } +} } // SceneGraph