From: Adeel Kazmi Date: Fri, 28 Jun 2019 17:31:59 +0000 (+0100) Subject: Process each RenderTask render-instruction separately X-Git-Tag: dali_1.4.28~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=07c2516c65ef56c71df4c9c3a7461781b06cb91b Process each RenderTask render-instruction separately Change-Id: I099321d85caf404cf8e9da35e0e7e3c573b3a22d --- diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index d578048..a208e2e 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -7205,7 +7205,7 @@ int utcDaliEnsureRenderWhenMakingLastActorInvisible(void) TestApplication application; auto stage = Stage::GetCurrent(); - tet_infoline( "Ensure we clear the screen when the last actor is removed" ); + tet_infoline( "Ensure we clear the screen when the last actor is made invisible" ); Actor actor = CreateRenderableActor(); actor.SetSize( 100.0f, 100.0f ); diff --git a/automated-tests/src/dali/utc-Dali-Scene.cpp b/automated-tests/src/dali/utc-Dali-Scene.cpp index 5f9e9d2..45eee5c 100644 --- a/automated-tests/src/dali/utc-Dali-Scene.cpp +++ b/automated-tests/src/dali/utc-Dali-Scene.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -826,3 +826,48 @@ int UtcDaliSceneSignalWheelEventP(void) END_TEST; } +int UtcDaliSceneEnsureEmptySceneCleared(void) +{ + tet_infoline( "Ensure we clear the newly added window" ); + + TestApplication application; + + // Create a new scene and set the background colors of both the new and the main scenes + auto defaultScene = application.GetScene(); + defaultScene.SetBackgroundColor( Color::WHITE ); + + auto newScene = Integration::Scene::New( Vector2( 480.0f, 800.0f ) ); + newScene.SetBackgroundColor( Color::RED ); + + // Need to create a renderable as we don't start rendering until we have at least one + // We don't need to add this to any scene + auto actor = CreateRenderableActor(); + + auto& glAbstraction = application.GetGlAbstraction(); + auto clearCountBefore = glAbstraction.GetClearCountCalled(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION ); + + // Add the actor to the main scene + defaultScene.Add( actor ); + + application.SendNotification(); + application.Render(); + + // Add another scene and set its background color, ensure we clear it to the appropriate color + + auto thirdScene = Integration::Scene::New( Vector2( 200.0f, 200.0f ) ); + thirdScene.SetBackgroundColor( Color::BLUE ); + + clearCountBefore = glAbstraction.GetClearCountCalled(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION ); + + END_TEST; +} diff --git a/dali/internal/update/manager/render-instruction-processor.cpp b/dali/internal/update/manager/render-instruction-processor.cpp index d1c332c..204a472 100644 --- a/dali/internal/update/manager/render-instruction-processor.cpp +++ b/dali/internal/update/manager/render-instruction-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -408,6 +408,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, renderTask.PrepareRenderInstruction( instruction, updateBufferIndex ); bool viewMatrixHasNotChanged = !renderTask.ViewMatrixUpdated(); bool isRenderListAdded = false; + bool isRootLayerDirty = false; const Matrix& viewMatrix = renderTask.GetViewMatrix( updateBufferIndex ); SceneGraph::Camera& camera = renderTask.GetCamera(); @@ -420,6 +421,12 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, const bool isLayer3D = layer.GetBehavior() == Dali::Layer::LAYER_3D; RenderList* renderList = NULL; + if( layer.IsRoot() && ( layer.GetDirtyFlags() != NodePropertyFlags::NOTHING ) ) + { + // If root-layer & dirty, i.e. a property has changed or a child has been deleted, then we need to ensure we render once more + isRootLayerDirty = true; + } + if( !layer.colorRenderables.Empty() ) { RenderableContainer& renderables = layer.colorRenderables; @@ -468,7 +475,7 @@ void RenderInstructionProcessor::Prepare( BufferIndex updateBufferIndex, // Inform the render instruction that all renderers have been added and this frame is complete. instruction.UpdateCompleted(); - if( !isRenderListAdded && !instruction.mIsClearColorSet ) + if( !isRenderListAdded && !instruction.mIsClearColorSet && !isRootLayerDirty ) { instructions.DiscardCurrentInstruction( updateBufferIndex ); } diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index ce5cfb8..852d5d4 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -983,15 +983,6 @@ uint32_t UpdateManager::Update( float elapsedSeconds, DALI_LOG_INFO( gLogFilter, Debug::General, "Update: numberOfRenderTasks(%d), Render Instructions(%d)\n", numberOfRenderTasks, mImpl->renderInstructions.Count( bufferIndex ) ); - - - - // If any node is dirty, i.e. a property has changed or a child has been deleted, and we do not have any instructions to send, then generate a dummy instruction to force another render - if( ( mImpl->nodeDirtyFlags != NodePropertyFlags::NOTHING ) && ( mImpl->renderInstructions.Count( bufferIndex ) == 0 ) ) - { - DALI_LOG_INFO( gLogFilter, Debug::General, "Node flags dirty, creating dummy instruction\n" ); - mImpl->renderInstructions.GetNextInstruction( bufferIndex ); // This creates and adds an empty instruction. We do not need to modify it. - } } }