/*
- * 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.
#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
#include <stdlib.h>
+#include <test-actor-utils.h>
#include <test-native-image.h>
#include <iostream>
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,
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);
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);
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);
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);
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));
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<GLuint> ids;
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);
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));
// Check that the actors were rendered
DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::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));
// Check that the actors were rendered
DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::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
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
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);
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);
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();
// 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();
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);
// 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();
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);
// 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();
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);
// 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();
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);
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);
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);
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();
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);
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)
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)
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