- application.GetPlatform().ClearReadyResources();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
-
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification(); // Input, Expected Input, Expected
- 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__ ) );
- 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 UtcDaliRenderTaskOnce04(void)
-{
- TestApplication application;
- tet_infoline("Testing RenderTask Render Once GlSync, 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 AN 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 );
-
- 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, 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, 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();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
-
- newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- application.SendNotification(); // Input, Expected Input, Expected
- 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__ ) );
- 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 UtcDaliRenderTaskOnce05(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once GlSync\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
- 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;
- 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, 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(); // 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, true, __LINE__ ) );
- Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- application.GetPlatform().ClearReadyResources();
-
- sync.SetObjectSynced( lastSyncObj, true );
-
- // Expect: No draw - we've just drawn our render task once, above. No finished signal -
- // we won't read the gl sync until the next frame. Continue rendering - we're waiting for
- // the sync
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
-
- // Expect: 1 final draw - this Update doesn't update the scene, hence render instructions
- // from last frame but 1 are still present.
- // Finished signal should be true - we've just done the sync.
- // Should now stop rendering and updating - nothing left to do.
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, true, false, __LINE__ ) );
-
- END_TEST;
-}
-
-int UtcDaliRenderTaskOnce07(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask Render Once GLSync\n"
- "Render once, Second call to SetRefreshRate(ONCE) triggers only one more 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();
- 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__ ) );
- Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
-
- 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__ ) );