ToolkitTestApplication application;
tet_infoline("UtcDaliRenderEffectRenderTaskOrdering");
- Integration::Scene scene = application.GetScene();
- RenderTaskList taskList = scene.GetRenderTaskList();
+ Integration::Scene scene = application.GetScene();
+ RenderTaskList taskList = scene.GetRenderTaskList();
Control control1 = Control::New();
control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
tet_printf("render task cnt after add : %d\n", taskList.GetTaskCount());
DALI_TEST_EQUALS(4, taskList.GetTaskCount(), TEST_LOCATION);
- Dali::RenderTask sourceTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 3);
+ Dali::RenderTask sourceTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 3);
Dali::RenderTask horizontalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 2);
- Dali::RenderTask verticalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 1);
+ Dali::RenderTask verticalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 1);
tet_printf("order : %d\n", sourceTaskControl1.GetOrderIndex());
tet_printf("order : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
DALI_TEST_EQUALS(0, sourceTaskControl1.GetOrderIndex(), TEST_LOCATION);
DALI_TEST_EQUALS(0, horizontalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
DALI_TEST_EQUALS(0, verticalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
-
+
application.SendNotification();
tet_printf("order af : %d\n", sourceTaskControl1.GetOrderIndex());
tet_printf("render task cnt after add : %d\n", taskList.GetTaskCount());
- Dali::RenderTask sourceTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 3);
+ Dali::RenderTask sourceTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 3);
Dali::RenderTask horizontalBlurTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 2);
- Dali::RenderTask verticalBlurTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 1);
-
+ Dali::RenderTask verticalBlurTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 1);
tet_printf("order after1 : %d\n", sourceTaskControl1.GetOrderIndex());
tet_printf("order after1 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
DALI_TEST_EQUALS(0, sourceTaskControl2.GetOrderIndex(), TEST_LOCATION);
DALI_TEST_EQUALS(0, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
DALI_TEST_EQUALS(0, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
-
+
application.SendNotification();
tet_printf("order after2 : %d\n", sourceTaskControl1.GetOrderIndex());
control2.Add(control1);
- sourceTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 3);
+ sourceTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 3);
horizontalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 2);
- verticalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 1);
+ verticalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 1);
tet_printf("order after3 : %d\n", sourceTaskControl1.GetOrderIndex());
tet_printf("order after3 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
DALI_TEST_EQUALS(INT32_MIN + 1, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
DALI_TEST_EQUALS(INT32_MIN + 2, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ control1.SetProperty(Actor::Property::VISIBLE, false);
+ control2.Unparent();
+
+ tet_printf("render task cnt after unparent : %d\n", taskList.GetTaskCount());
+
+ // The order index is not defined now.
+ tet_printf("order after5 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after5 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after5 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after5 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after5 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after5 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ application.SendNotification();
+
+ tet_printf("order after6 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after6 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after6 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after6 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after6 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after6 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ scene.Add(control2);
+
+ tet_printf("render task cnt after re-add : %d\n", taskList.GetTaskCount());
+
+ sourceTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 3);
+ horizontalBlurTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 2);
+ verticalBlurTaskControl2 = taskList.GetTask(taskList.GetTaskCount() - 1);
+
+ tet_printf("order after7 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after7 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after7 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after7 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after7 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after7 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ DALI_TEST_EQUALS(0, sourceTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+
+ application.SendNotification();
+
+ tet_printf("order after8 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after8 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after8 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after8 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after8 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after8 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ DALI_TEST_EQUALS(INT32_MIN, sourceTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 1, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 2, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+
+ control1.SetProperty(Actor::Property::VISIBLE, true);
+
+ tet_printf("render task cnt after change visible : %d\n", taskList.GetTaskCount());
+
+ sourceTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 3);
+ horizontalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 2);
+ verticalBlurTaskControl1 = taskList.GetTask(taskList.GetTaskCount() - 1);
+
+ tet_printf("order after9 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after9 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after9 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after9 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after9 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after9 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ DALI_TEST_EQUALS(0, sourceTaskControl1.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, horizontalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, verticalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
+
+ DALI_TEST_EQUALS(INT32_MIN, sourceTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 1, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 2, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+
+ application.SendNotification();
+
+ tet_printf("order after10 : %d\n", sourceTaskControl1.GetOrderIndex());
+ tet_printf("order after10 : %d\n", horizontalBlurTaskControl1.GetOrderIndex());
+ tet_printf("order after10 : %d\n", verticalBlurTaskControl1.GetOrderIndex());
+
+ tet_printf("order after10 : %d\n", sourceTaskControl2.GetOrderIndex());
+ tet_printf("order after10 : %d\n", horizontalBlurTaskControl2.GetOrderIndex());
+ tet_printf("order after10 : %d\n", verticalBlurTaskControl2.GetOrderIndex());
+
+ DALI_TEST_EQUALS(INT32_MIN + 3, sourceTaskControl1.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 4, horizontalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 5, verticalBlurTaskControl1.GetOrderIndex(), TEST_LOCATION);
+
+ DALI_TEST_EQUALS(INT32_MIN, sourceTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 1, horizontalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+ DALI_TEST_EQUALS(INT32_MIN + 2, verticalBlurTaskControl2.GetOrderIndex(), TEST_LOCATION);
+
END_TEST;
}
-
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/actors/custom-actor-impl.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/shader.h>
-#include <dali/public-api/actors/custom-actor-impl.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
tasks.clear();
if(!isForward && mIsBackground)
{
- bool isExclusiveRequired = false;
- Dali::Actor sourceActor = GetOwnerControl();
- while(sourceActor.GetParent())
- {
- sourceActor = sourceActor.GetParent();
- Toolkit::Control control = Toolkit::Control::DownCast(sourceActor);
- if(control && GetImplementation(control).GetOffScreenRenderableType() == OffScreenRenderable::Type::FORWARD)
- {
- sourceActor = GetImplementation(control).GetOffScreenRenderableSourceActor();
- isExclusiveRequired = GetImplementation(control).IsOffScreenRenderTaskExclusive();
- break;
- }
- }
- mSourceRenderTask.SetSourceActor(sourceActor);
- mSourceRenderTask.SetExclusive(isExclusiveRequired);
-
if(mSourceRenderTask)
{
+ // Re-initialize source actor of rendertask since it might be changed.
+ // TODO : Should it be required always? Couldn't we skip it?
+ ApplyRenderTaskSourceActor(mSourceRenderTask, GetOwnerControl());
tasks.push_back(mSourceRenderTask);
}
if(mHorizontalBlurTask)
SetRendererTexture(renderer, mSourceFrameBuffer);
ownerControl.Add(mInternalRoot);
+
+ // Reorder render task
+ // TODO : Can we remove this GetImplementation?
+ GetImplementation(ownerControl).RequestRenderTaskReorder();
}
void BlurEffectImpl::OnDeactivate()
// draw input texture
mSourceRenderTask = taskList.CreateTask();
- if(mIsBackground)
- {
- mSourceRenderTask.SetSourceActor(sceneHolder.GetRootLayer());
- mSourceRenderTask.RenderUntil(sourceControl);
- }
- else
- {
- mSourceRenderTask.SetSourceActor(sourceControl);
- }
mSourceRenderTask.SetCameraActor(mRenderFullSizeCamera);
mSourceRenderTask.SetFrameBuffer(mInputBackgroundFrameBuffer);
mSourceRenderTask.SetInputEnabled(false);
- mSourceRenderTask.SetExclusive(false);
+
+ ApplyRenderTaskSourceActor(mSourceRenderTask, sourceControl);
// Clear inputBackgroundTexture as scene holder background.
mSourceRenderTask.SetClearEnabled(true);
mVerticalBlurTask.SetClearColor(Color::TRANSPARENT);
}
+void BlurEffectImpl::ApplyRenderTaskSourceActor(RenderTask sourceRenderTask, const Toolkit::Control sourceControl)
+{
+ if(DALI_UNLIKELY(!sourceRenderTask || !sourceControl))
+ {
+ return;
+ }
+
+ bool isExclusiveRequired = false;
+ Dali::Actor sourceActor = sourceControl;
+ Dali::Actor stopperActor = Dali::Actor(); // Give empty handle to invalidate previous render until option.
+
+ if(mIsBackground)
+ {
+ stopperActor = sourceControl;
+ while(sourceActor && sourceActor.GetParent())
+ {
+ sourceActor = sourceActor.GetParent();
+ Toolkit::Control control = Toolkit::Control::DownCast(sourceActor);
+ if(control && GetImplementation(control).GetOffScreenRenderableType() == OffScreenRenderable::Type::FORWARD)
+ {
+ sourceActor = GetImplementation(control).GetOffScreenRenderableSourceActor();
+ isExclusiveRequired = GetImplementation(control).IsOffScreenRenderTaskExclusive();
+ break;
+ }
+ }
+ }
+
+ sourceRenderTask.SetExclusive(isExclusiveRequired);
+ sourceRenderTask.SetSourceActor(sourceActor);
+ sourceRenderTask.RenderUntil(stopperActor);
+}
+
Vector2 BlurEffectImpl::GetTargetSizeForValidTexture() const
{
Vector2 size = GetTargetSize();