X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-RenderTask.cpp;h=9b5e9de633facf1debb7418d99a188aaf57c1cf6;hb=3d95d69c92f1c9294479bf14ffaa66b8da840356;hp=e58f206f5ad0c8a36ca3ebbbc32ae2d9d44edca8;hpb=24def5f2404af8733d5a50beb1249639707c3d08;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index e58f206..9b5e9de 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -174,9 +175,9 @@ Actor CreateRenderableActorSuccess(TestApplication& application, std::string fil return actor; } -Texture CreateTexture() +Texture CreateTexture(void) { - return Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 80u, 80u); + return Dali::CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 80, 80); } RenderTask CreateRenderTask(TestApplication& application, @@ -346,7 +347,7 @@ int UtcDaliRenderTaskSetSourceActorP01(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -390,7 +391,7 @@ int UtcDaliRenderTaskSetSourceActorP02(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -449,7 +450,7 @@ int UtcDaliRenderTaskSetSourceActorOffScene(void) TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); task.SetSourceActor(newActor); @@ -498,7 +499,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); stage.Add(newActor); @@ -548,7 +549,7 @@ int UtcDaliRenderTaskSetSourceActorDestroyed(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK(actor); - Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor newActor = CreateRenderableActor(img); newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -635,6 +636,14 @@ int UtcDaliRenderTaskSetExclusive(void) RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + // Creates: + // Root + // Actor1 Layer Layer + // Actor2 Actor3 + + // Task 1 is the default render task, should render from Root, incl Actor2 + // Task 2 uses Actor2 as a source actor (texture id 9) + // Manipulate the GenTextures behaviour, to identify different actors std::vector ids; @@ -643,7 +652,7 @@ int UtcDaliRenderTaskSetExclusive(void) ids.push_back(10); // 10 = actor3 application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor1 = CreateRenderableActor(img1); actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); application.GetScene().Add(actor1); @@ -658,15 +667,11 @@ int UtcDaliRenderTaskSetExclusive(void) if(boundTextures.size()) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); - if(boundTextures.size() > 1) - { - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); - } + int a = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 8u /*unique to actor1*/, TEST_LOCATION); } - Texture img2 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img2 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor2 = CreateRenderableActor(img2); actor2.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -685,18 +690,15 @@ int UtcDaliRenderTaskSetExclusive(void) // Check that the actors were rendered DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(1), TEST_LOCATION); - if(boundTextures.size()) + if(boundTextures.size() >= 2) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); - if(boundTextures.size() > 2) - { - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor1*/, TEST_LOCATION); - } - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); + int a = boundTextures.size() - 2; + int b = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 8u /*unique to actor1*/, TEST_LOCATION); } - Texture img3 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img3 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor3 = CreateRenderableActor(img3); actor3.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); @@ -714,16 +716,14 @@ int UtcDaliRenderTaskSetExclusive(void) // Check that the actors were rendered DALI_TEST_GREATER(boundTextures.size(), static_cast::size_type>(2), TEST_LOCATION); - if(boundTextures.size()) + if(boundTextures.size() >= 3) { - int c = 0; - DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor3*/, TEST_LOCATION); - if(boundTextures.size() > 3) - { - DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor2*/, TEST_LOCATION); - } - DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION); - DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION); + int a = boundTextures.size() - 3; + int b = boundTextures.size() - 2; + int c = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 10u /*unique to actor3*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[c], 8u /*unique to actor1*/, TEST_LOCATION); } // Both actors are now connected to the root node @@ -743,17 +743,19 @@ int UtcDaliRenderTaskSetExclusive(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS(boundTextures.size(), 4u, TEST_LOCATION); - - if(boundTextures.size() == 4) + if(boundTextures.size() >= 4) { // Test that task 1 renders actor3, then actor2 & then actor1 - DALI_TEST_CHECK(boundTextures[0] == 10u); - DALI_TEST_CHECK(boundTextures[1] == 9u); - DALI_TEST_CHECK(boundTextures[2] == 8u); + int a = boundTextures.size() - 4; + int b = boundTextures.size() - 3; + int c = boundTextures.size() - 2; + int d = boundTextures.size() - 1; + DALI_TEST_EQUALS(boundTextures[a], 10u /*unique to actor3*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[b], 9u /*unique to actor2*/, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[c], 8u /*unique to actor1*/, TEST_LOCATION); // Test that task 2 renders actor2 - DALI_TEST_EQUALS(boundTextures[3], 9u, TEST_LOCATION); + DALI_TEST_EQUALS(boundTextures[d], 9u, TEST_LOCATION); } // Make actor2 exclusive to task2 @@ -796,7 +798,7 @@ int UtcDaliRenderTaskSetExclusive02(void) ids.push_back(8); // 8 = actor1 application.GetGlAbstraction().SetNextTextureIds(ids); - Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + Texture img1 = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); Actor actor1 = CreateRenderableActor(img1); actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f)); application.GetScene().Add(actor1); @@ -1790,13 +1792,13 @@ int UtcDaliRenderTaskSignalFinished(void) tet_infoline("Testing RenderTask::SignalFinished()"); application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + auto& sync = application.GetGraphicsSyncImpl(); CameraActor offscreenCameraActor = CameraActor::New(); application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); application.GetScene().Add(rootActor); @@ -1832,7 +1834,7 @@ int UtcDaliRenderTaskSignalFinished(void) application.SendNotification(); DALI_TEST_CHECK(!finished); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); @@ -2011,8 +2013,8 @@ int UtcDaliRenderTaskOnce01(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2032,7 +2034,7 @@ int UtcDaliRenderTaskOnce01(void) DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2049,8 +2051,8 @@ int UtcDaliRenderTaskOnce02(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2079,7 +2081,7 @@ int UtcDaliRenderTaskOnce02(void) DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2097,8 +2099,8 @@ int UtcDaliRenderTaskOnce03(void) // SETUP A CONTINUOUS OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2119,10 +2121,10 @@ int UtcDaliRenderTaskOnce03(void) newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - + // drawn sig finished Keep updating DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2141,8 +2143,8 @@ int UtcDaliRenderTaskOnce04(void) // SETUP AN OFFSCREEN RENDER TASK application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); drawTrace.Enable(true); Actor rootActor = Actor::New(); @@ -2173,10 +2175,10 @@ int UtcDaliRenderTaskOnce04(void) newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); application.SendNotification(); - + // FAILS drawn sig finished Keep updating DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); sync.SetObjectSynced(lastSyncObj, true); @@ -2336,8 +2338,8 @@ int UtcDaliRenderTaskOnceNoSync04(void) application.SendNotification(); DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__)); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + auto& sync = application.GetGraphicsSyncImpl(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj == NULL); newTask.SetRefreshRate(RenderTask::REFRESH_ONCE); @@ -2463,13 +2465,13 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) tet_infoline("Testing RenderTask::FinishInvisibleSourceActor()"); application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); - TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction(); + auto& sync = application.GetGraphicsSyncImpl(); CameraActor offscreenCameraActor = CameraActor::New(); application.GetScene().Add(offscreenCameraActor); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); rootActor.SetProperty(Actor::Property::VISIBLE, false); @@ -2512,7 +2514,7 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) application.SendNotification(); DALI_TEST_CHECK(!finished); - Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); DALI_TEST_CHECK(lastSyncObj != NULL); application.Render(); @@ -2552,7 +2554,7 @@ int UtcDaliRenderTaskFinishMissingImage(void) Integration::Scene stage = application.GetScene(); - Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); + Texture image = CreateTexture(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10); Actor rootActor = CreateRenderableActor(image); rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f)); stage.Add(rootActor); @@ -3406,7 +3408,9 @@ int UtcDaliRenderTaskClippingMode01(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) + std::ostringstream scissor; + scissor << std::hex << GL_SCISSOR_TEST; + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str())); // Check the scissor was set, and the coordinates are correct. Vector4 expectResults(position.x, TestApplication::DEFAULT_SURFACE_HEIGHT - size.height - position.y, size.width, size.height); // (100, 500, 200, 200) @@ -3464,7 +3468,9 @@ int UtcDaliRenderTaskClippingMode02(void) application.SendNotification(); application.Render(); - DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST) + std::ostringstream scissor; + scissor << std::hex << GL_SCISSOR_TEST; + DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", scissor.str())); // Check the scissor was set, and the coordinates are correct. Vector4 expectResults(position.x, position.y, size.width, size.height); // (100, 100, 200, 200) @@ -3474,3 +3480,48 @@ int UtcDaliRenderTaskClippingMode02(void) END_TEST; } + +int UtcDaliRenderTaskUploadOnly(void) +{ + TestApplication application; + + tet_infoline("Testing RenderTask Render Once GlSync, using loaded image"); + + // SETUP AN OFFSCREEN RENDER TASK + application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); + auto& sync = application.GetGraphicsSyncImpl(); + TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace(); + drawTrace.Enable(true); + + Actor rootActor = Actor::New(); + application.GetScene().Add(rootActor); + + CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT)); + application.GetScene().Add(offscreenCameraActor); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); + + application.GetScene().Add(secondRootActor); + + RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true); + bool finished = false; + RenderTaskFinished renderTaskFinished(finished); + newTask.FinishedSignal().Connect(&application, renderTaskFinished); + application.SendNotification(); + + DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__)); + + Integration::GraphicsSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject(); + DALI_TEST_CHECK(lastSyncObj != NULL); + sync.SetObjectSynced(lastSyncObj, true); + + application.SendNotification(); + application.Render(16, nullptr, true); + + DALI_TEST_CHECK(!finished); + + application.Render(16, nullptr, true); + application.SendNotification(); + + DALI_TEST_CHECK(!finished); + END_TEST; +} \ No newline at end of file