From: Kimmo Hoikka Date: Fri, 26 May 2017 09:37:20 +0000 (+0100) Subject: Remove dead logic handling renderer ready and completion X-Git-Tag: dali_1.2.42~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F21%2F131321%2F3;p=platform%2Fcore%2Fuifw%2Fdali-core.git Remove dead logic handling renderer ready and completion - its not possible to have a renderer without scene graph geometry and shader - renderers are now ready and complete as soon as they are ready, i.e. have valid geometry and shader Change-Id: I197c7af70a4c204260558a57b54bd69a2830f410 --- diff --git a/dali/internal/update/manager/render-task-processor.cpp b/dali/internal/update/manager/render-task-processor.cpp index 7e3447f..18cb3ee 100644 --- a/dali/internal/update/manager/render-task-processor.cpp +++ b/dali/internal/update/manager/render-task-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,6 @@ Layer* FindLayer( Node& node ) /** * Rebuild the Layer::colorRenderables and overlayRenderables members, * including only renderers which are included in the current render-task. - * Returns true if all renderers have finished acquiring resources. * * @param[in] updateBufferIndex The current update buffer index. * @param[in] node The current node of the scene-graph. @@ -98,7 +97,7 @@ Layer* FindLayer( Node& node ) * Note: ClippingId is passed by reference, so it is permanently modified when traversing back up the tree for uniqueness. * @param[in] clippingDepth The current clipping depth */ -bool AddRenderablesForTask( BufferIndex updateBufferIndex, +void AddRenderablesForTask( BufferIndex updateBufferIndex, Node& node, Layer& currentLayer, RenderTask& renderTask, @@ -106,19 +105,17 @@ bool AddRenderablesForTask( BufferIndex updateBufferIndex, uint32_t& currentClippingId, uint32_t clippingDepth ) { - bool resourcesFinished = true; - // Short-circuit for invisible nodes if( !node.IsVisible( updateBufferIndex ) ) { - return resourcesFinished; + return; } // Check whether node is exclusive to a different render-task const RenderTask* exclusiveTo = node.GetExclusiveRenderTask(); if( exclusiveTo && ( exclusiveTo != &renderTask ) ) { - return resourcesFinished; + return; } // Assume all children go to this layer (if this node is a layer). @@ -150,25 +147,15 @@ bool AddRenderablesForTask( BufferIndex updateBufferIndex, for( unsigned int i = 0; i < count; ++i ) { SceneGraph::Renderer* renderer = node.GetRendererAt( i ); - bool ready = false; - bool complete = false; - renderer->GetReadyAndComplete( ready, complete ); - - DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "Testing renderable:%p ready:%s complete:%s\n", renderer, ready ? "T" : "F", complete ? "T" : "F" ); - - resourcesFinished &= complete; - if( ready ) // IE. should be rendered (all resources are available) + // Normal is the more-likely draw mode to occur. + if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) ) { - // Normal is the more-likely draw mode to occur. - if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) ) - { - layer->colorRenderables.PushBack( Renderable( &node, renderer ) ); - } - else - { - layer->overlayRenderables.PushBack( Renderable( &node, renderer ) ); - } + layer->colorRenderables.PushBack( Renderable( &node, renderer ) ); + } + else + { + layer->overlayRenderables.PushBack( Renderable( &node, renderer ) ); } } @@ -178,11 +165,8 @@ bool AddRenderablesForTask( BufferIndex updateBufferIndex, for( NodeIter iter = children.Begin(); iter != endIter; ++iter ) { Node& child = **iter; - bool childResourcesComplete = AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth ); - resourcesFinished &= childResourcesComplete; + AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth ); } - - return resourcesFinished; } } // Anonymous namespace. @@ -250,7 +234,6 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, continue; } - bool resourcesFinished = false; if( renderTask.IsRenderRequired() ) { size_t layerCount( sortedLayers.size() ); @@ -259,15 +242,13 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, sortedLayers[i]->ClearRenderables(); } - resourcesFinished = AddRenderablesForTask( updateBufferIndex, - *sourceNode, - *layer, - renderTask, - sourceNode->GetDrawMode(), - clippingId, - 0u ); - - renderTask.SetResourcesFinished( resourcesFinished ); + AddRenderablesForTask( updateBufferIndex, + *sourceNode, + *layer, + renderTask, + sourceNode->GetDrawMode(), + clippingId, + 0u ); // If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList. hasClippingNodes = clippingId != 0u; @@ -279,10 +260,6 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, hasClippingNodes, instructions ); } - else - { - renderTask.SetResourcesFinished( resourcesFinished ); - } } DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" ); @@ -317,7 +294,6 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, continue; } - bool resourcesFinished = false; if( renderTask.IsRenderRequired() ) { size_t layerCount( sortedLayers.size() ); @@ -326,13 +302,13 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, sortedLayers[i]->ClearRenderables(); } - resourcesFinished = AddRenderablesForTask( updateBufferIndex, - *sourceNode, - *layer, - renderTask, - sourceNode->GetDrawMode(), - clippingId, - 0u ); + AddRenderablesForTask( updateBufferIndex, + *sourceNode, + *layer, + renderTask, + sourceNode->GetDrawMode(), + clippingId, + 0u ); // If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList. hasClippingNodes = clippingId != 0; @@ -344,8 +320,6 @@ void RenderTaskProcessor::Process( BufferIndex updateBufferIndex, hasClippingNodes, instructions ); } - - renderTask.SetResourcesFinished( resourcesFinished ); } } diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.cpp b/dali/internal/update/render-tasks/scene-graph-render-task.cpp index 96dfbc9..c637d24 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.cpp +++ b/dali/internal/update/render-tasks/scene-graph-render-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -254,17 +254,11 @@ bool RenderTask::IsRenderRequired() return required; } -void RenderTask::SetResourcesFinished( bool resourcesFinished ) -{ - // resourcesFinished tells us that this render task will render to its FBO - mResourcesFinished = resourcesFinished; -} - // Called every frame regardless of whether render was required. // If render was not required, ignore resourcesFinished. void RenderTask::UpdateState() { - TASK_LOG_FMT( Debug::General, "(mResourcesFinished:%s) FC:%d State:%s RR:%d\n", mResourcesFinished?"T":"F", mFrameCounter, STATE_STRING(mState), mRefreshRate ); + TASK_LOG_FMT( Debug::General, "FC:%d State:%s RR:%d\n", mFrameCounter, STATE_STRING(mState), mRefreshRate ); switch( mState ) { @@ -274,10 +268,7 @@ void RenderTask::UpdateState() { if( mFrameCounter == 0 ) { - if( mResourcesFinished ) - { - ++mFrameCounter; // Only start skipping frames when resources are loaded - } + ++mFrameCounter; // Only start skipping frames when resources are loaded } else // Continue counting to skip frames { @@ -294,10 +285,7 @@ void RenderTask::UpdateState() case RENDER_ONCE_WAITING_FOR_RESOURCES: { - if( mResourcesFinished ) - { - mState = RENDERED_ONCE; - } + mState = RENDERED_ONCE; } break; @@ -390,8 +378,7 @@ void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, Buffe mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL ); if( mRequiresSync && - mRefreshRate == Dali::RenderTask::REFRESH_ONCE && - mResourcesFinished ) + mRefreshRate == Dali::RenderTask::REFRESH_ONCE ) { // create tracker if one doesn't yet exist. if( !mRenderSyncTracker ) @@ -484,7 +471,6 @@ RenderTask::RenderTask() mCameraNode( NULL ), mCamera( NULL ), mFrameBuffer(0), - mResourcesFinished( false ), mWaitingToRender( false ), mNotifyTrigger( false ), mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ), diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.h b/dali/internal/update/render-tasks/scene-graph-render-task.h index 516d993..643dd4e 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -269,12 +269,6 @@ public: bool IsRenderRequired(); /** - * Set whether all resources were available when the render-task was processed - * @param[in] resourcesComplete True if the resources of the source tree are completely loaded. - */ - void SetResourcesFinished( bool resourcesFinished ); - - /** * Process a frame. This method is called each frame for every ready render task, regardless * of whether it needs to render (so that the frame counter can be updated). */ @@ -376,7 +370,6 @@ private: SceneGraph::Camera* mCamera; Render::FrameBuffer* mFrameBuffer; - bool mResourcesFinished:1; ///< True if all resources were available when the render-task was processed bool mWaitingToRender:1; ///< True when an render once to FBO is waiting bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation). diff --git a/dali/internal/update/rendering/scene-graph-renderer.cpp b/dali/internal/update/rendering/scene-graph-renderer.cpp index 732ca23..9718893 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.cpp +++ b/dali/internal/update/rendering/scene-graph-renderer.cpp @@ -142,8 +142,6 @@ Renderer::Renderer() mBlendMode( BlendMode::AUTO ), mDepthWriteMode( DepthWriteMode::AUTO ), mDepthTestMode( DepthTestMode::AUTO ), - mResourcesReady( false ), - mFinishedResourceAcquisition( false ), mPremultipledAlphaEnabled( false ), mDepthIndex( 0 ) { @@ -176,21 +174,8 @@ void Renderer::operator delete( void* ptr ) void Renderer::PrepareRender( BufferIndex updateBufferIndex ) { - mResourcesReady = false; - mFinishedResourceAcquisition = false; - - // Can only be considered ready when all the scene graph objects are connected to the renderer - if( mGeometry && mShader ) - { - mResourcesReady = true; - mFinishedResourceAcquisition = true; - } - if( mRegenerateUniformMap > UNIFORM_MAP_READY ) { - DALI_ASSERT_DEBUG( mGeometry != NULL && "No geometry available in PrepareRender()" ); - DALI_ASSERT_DEBUG( mShader != NULL && "No shader available in PrepareRender()" ); - if( mRegenerateUniformMap == REGENERATE_UNIFORM_MAP) { CollectedUniformMap& localMap = mCollectedUniformMap[ updateBufferIndex ]; @@ -238,7 +223,6 @@ void Renderer::PrepareRender( BufferIndex updateBufferIndex ) { typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType; unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) ); - new (slot) DerivedType( mRenderer, &Render::Renderer::SetGeometry, mGeometry ); } @@ -602,12 +586,6 @@ const CollectedUniformMap& Renderer::GetUniformMap( BufferIndex bufferIndex ) co return mCollectedUniformMap[bufferIndex]; } -void Renderer::GetReadyAndComplete( bool& ready, bool& complete ) const -{ - ready = mResourcesReady; - complete = mFinishedResourceAcquisition; -} - Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const { Renderer::Opacity opacity = Renderer::OPAQUE; diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index b150ee3..ee6762d 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -255,17 +255,6 @@ public: Render::Renderer& GetRenderer(); /** - * Check whether the renderer has been marked as ready to render - * ready means that renderer has all resources and should produce correct result - * complete means all resources have finished loading - * It's possible that renderer is complete but not ready, - * for example in case of resource load failed - * @param[out] ready TRUE if the renderer has resources to render - * @param[out] complete TRUE if the renderer resources are complete - */ - void GetReadyAndComplete( bool& ready, bool& complete ) const; - - /** * Query whether the renderer is fully opaque, fully transparent or transparent. * @param[in] updateBufferIndex The current update buffer index. * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between @@ -393,13 +382,12 @@ private: DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame - bool mResourcesReady; ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame. - bool mFinishedResourceAcquisition; ///< Set during DoPrepareResources; true if ready & all resource acquisition has finished (successfully or otherwise) bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required public: int mDepthIndex; ///< Used only in PrepareRenderInstructions + };