- tet_infoline("Testing RenderTask Render Once GLSync\n"
- "Render once, Call to SetRefreshRate(ONCE) in Finished signal callback triggers "
- "another render & another finished signal\n"
- "PRE: Everything ready\n"
- "POST: exactly 1 finished signal per call to SetRefreshRate(ONCE)");
-
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- sync.GetTrace().Enable(true);
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
- Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- application.Render();
- application.GetPlatform().ClearReadyResources();
-
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, /*GL-SYNC*/ true);
- bool finished = false;
-
- ConnectionTracker connectionTracker;
- RenderTaskFinishedRenderAgain renderTaskFinishedRenderAgain( finished );
- newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinishedRenderAgain );
-
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
- Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
- DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 0, TEST_LOCATION );
-
-
- // CHANGE TO RENDER ONCE,
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION );
-
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
-
- DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION );
-
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- DALI_TEST_EQUALS( sync.GetNumberOfSyncObjects(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( sync.GetTrace().CountMethod( "CreateSyncObject" ), 1, TEST_LOCATION );
-
- sync.SetObjectSynced( lastSyncObj, true );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
- application.SendNotification();
-
- // Expect SetRefreshRate to have been called again
- // Prevent next finished signal calling refresh once again
- RenderTaskFinished renderTaskFinished( finished );
- connectionTracker.DisconnectAll();
- newTask.FinishedSignal().Connect( &connectionTracker, renderTaskFinished );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
-
- sync.SetObjectSynced( lastSyncObj, true );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
- END_TEST;
-}
-
-
-int UtcDaliRenderTaskOnce09(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once GlSync\n"
- "SetRefreshRate(ONCE) again before first finished signal has been sent.\n"
- "PRE: resources ready\n"
- "POST: Only 1 finished signal sent.");
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
- Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- application.Render();
- application.GetPlatform().ClearReadyResources();
-
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
-
- // CHANGE TO RENDER ONCE,
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
-
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- sync.SetObjectSynced( lastSyncObj, true );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
-
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnce10(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once GlSync\n"
- "SetRefreshRate(ONCE), resource load failed completes render task.\n"
- "PRE: resources not ready\n"
- "POST: Only 1 finished signal sent.");
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
- Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- // CHANGE TO RENDER ONCE,
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- tet_printf(" FailImageLoad\n");
-
- FailImageLoad(application, imageRequestId); // Need to run Update again for this to complete
-
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) ); // nothing to draw
- application.SendNotification();
-
- // load is now failed so there's nothing more to render in the render task
- // Expect finished signal, as all resources are complete
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
-
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnceNoSync01(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once, using loading image\nPRE: Resources not ready, Source not visible\nPOST: Finished signal sent once only");
-
- // SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
- Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
-
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- // FINISH RESOURCE LOADING - expect immediate rendering yet
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- application.GetPlatform().ClearReadyResources();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnceNoSync02(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
- "PRE: Resources not ready\nPOST: Finished signal sent once only");
- // SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
-
- Shader shader = CreateShader();
- Image image = CreateLoadingImage(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
- TextureSet textureSet = CreateTextureSet( image );
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
- Actor secondRootActor = Actor::New();
- secondRootActor.AddRenderer(renderer);
- secondRootActor.SetSize(100, 100);
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- // FINISH RESOURCE LOADING - expect immediate rendering yet
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- application.GetPlatform().ClearReadyResources();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
-
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnceNoSync03(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once, using loading image. Switch from render always after ready to render once\n"
- "PRE: Render task ready, Image not loaded\n"
- "POST: Finished signal sent only once");
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
- Actor secondRootActor = CreateLoadingActor(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
- Stage::GetCurrent().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- // FINISH RESOURCE LOADING
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
- application.GetPlatform().ClearReadyResources();
-
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification(); // Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnceNoSync04(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
- "Switch from render always after ready to render once\n"
- "PRE: Render task ready, Image not loaded\n"
- "POST: Finished signal sent only once");
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
- drawTrace.Enable(true);
-
- Actor rootActor = Actor::New();
- Stage::GetCurrent().Add( rootActor );
-
- CameraActor offscreenCameraActor = CameraActor::New();
- Stage::GetCurrent().Add( offscreenCameraActor );
-
- Shader shader = CreateShader();
- Image image = CreateLoadingImage(application, "aFile.jpg");
- Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
- Integration::ResourceId imageRequestId = imageRequest->GetId();
- Integration::ResourceTypeId imageType = imageRequest->GetType()->id;
- TextureSet textureSet = CreateTextureSet( image );
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
- Actor secondRootActor = Actor::New();
- secondRootActor.AddRenderer(renderer);
- secondRootActor.SetSize(100, 100);
- Stage::GetCurrent().Add(secondRootActor);
-
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
- application.SendNotification();
-
- // START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
-
- // FINISH RESOURCE LOADING
- CompleteImageLoad(application, imageRequestId, imageType); // Need to run update again for this to complete
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
- application.GetPlatform().ClearReadyResources();
-
- lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
-
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification(); // Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
-
- lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
-
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnceNoSync05(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once\n"
- "Switch from Render always after ready to render once with resources unready\n"
- "PRE: Everything ready to render\n"
- "POST: Finished signal sent once");
-
- // SETUP A CONTINUOUS OFFSCREEN RENDER TASK