X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-adaptor%2Fdali-test-suite-utils%2Ftest-graphics-application.cpp;h=eeacebe87e3a37ebe1b222eba2b5d00560beb69f;hb=738af85a1b87813312227305117798edf85af875;hp=96b999d3e45e52cda0537ba7a824cb3d5a026551;hpb=42cbcc90aa7b66956f4d17b992e77e4f9e2b995a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp index 96b999d..eeacebe 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -16,6 +16,7 @@ */ #include "test-graphics-application.h" +#include namespace Dali { @@ -50,11 +51,19 @@ void TestGraphicsApplication::Initialize() void TestGraphicsApplication::CreateCore() { + Dali::Integration::Log::LogFunction logFunction(&TestGraphicsApplication::LogMessage); + Dali::Integration::Log::InstallLogFunction(logFunction); + + Dali::Integration::Trace::LogContextFunction logContextFunction(&TestGraphicsApplication::LogContext); + Dali::Integration::Trace::InstallLogContextFunction(logContextFunction); + // We always need the first update! mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING; + mGraphics.Initialize(); mGraphicsController.InitializeGLES(mGlAbstraction); - mGraphicsController.Initialize(mGlSyncAbstraction, mGlContextHelperAbstraction); + mGraphicsController.Initialize(mGraphicsSyncImplementation, mGlContextHelperAbstraction, mGraphics); + mGraphicsController.ActivateResourceContext(); mCore = Dali::Integration::Core::New(mRenderController, mPlatformAbstraction, @@ -66,12 +75,6 @@ void TestGraphicsApplication::CreateCore() mCore->ContextCreated(); - Dali::Integration::Log::LogFunction logFunction(&TestGraphicsApplication::LogMessage); - Dali::Integration::Log::InstallLogFunction(logFunction); - - Dali::Integration::Trace::LogContextFunction logContextFunction(&TestGraphicsApplication::LogContext); - Dali::Integration::Trace::InstallLogContextFunction(logContextFunction); - Dali::Integration::Trace::LogContext(true, "Test"); } @@ -79,6 +82,13 @@ void TestGraphicsApplication::CreateScene() { mScene = Dali::Integration::Scene::New(Size(static_cast(mSurfaceWidth), static_cast(mSurfaceHeight))); mScene.SetDpi(Vector2(static_cast(mDpi.x), static_cast(mDpi.y))); + + Graphics::RenderTargetCreateInfo createInfo{}; + createInfo.SetSurface({nullptr}) + .SetExtent({mSurfaceWidth, mSurfaceHeight}) + .SetPreTransform(0 | Graphics::RenderTargetTransformFlagBits::TRANSFORM_IDENTITY_BIT); + //mRenderTarget = mGraphicsController.CreateRenderTarget(createInfo, nullptr); + mScene.SetSurfaceRenderTarget(createInfo); } void TestGraphicsApplication::InitializeCore() @@ -89,19 +99,20 @@ void TestGraphicsApplication::InitializeCore() TestGraphicsApplication::~TestGraphicsApplication() { + mGraphicsController.Shutdown(); Dali::Integration::Log::UninstallLogFunction(); delete mCore; } -void TestGraphicsApplication::LogContext(bool start, const char* tag) +void TestGraphicsApplication::LogContext(bool start, const char* tag, const char* message) { if(start) { - fprintf(stderr, "INFO: Trace Start: %s\n", tag); + fprintf(stderr, "INFO: Trace Start: %s %s\n", tag, message ? message : ""); } else { - fprintf(stderr, "INFO: Trace End: %s\n", tag); + fprintf(stderr, "INFO: Trace End: %s %s\n", tag, message ? message : ""); } } @@ -111,13 +122,16 @@ void TestGraphicsApplication::LogMessage(Dali::Integration::Log::DebugPriority l { switch(level) { - case Dali::Integration::Log::DebugInfo: + case Dali::Integration::Log::DEBUG: + fprintf(stderr, "DEBUG: %s", message.c_str()); + break; + case Dali::Integration::Log::INFO: fprintf(stderr, "INFO: %s", message.c_str()); break; - case Dali::Integration::Log::DebugWarning: + case Dali::Integration::Log::WARNING: fprintf(stderr, "WARN: %s", message.c_str()); break; - case Dali::Integration::Log::DebugError: + case Dali::Integration::Log::ERROR: fprintf(stderr, "ERROR: %s", message.c_str()); break; default: @@ -152,11 +166,6 @@ TestGlAbstraction& TestGraphicsApplication::GetGlAbstraction() return static_cast(mGraphicsController.GetGlAbstraction()); } -TestGlSyncAbstraction& TestGraphicsApplication::GetGlSyncAbstraction() -{ - return static_cast(mGraphicsController.GetGlSyncAbstraction()); -} - TestGlContextHelperAbstraction& TestGraphicsApplication::GetGlContextHelperAbstraction() { return static_cast(mGraphicsController.GetGlContextHelperAbstraction()); @@ -185,7 +194,7 @@ void TestGraphicsApplication::DoUpdate(uint32_t intervalMilliseconds, const char uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds; float elapsedSeconds = static_cast(intervalMilliseconds) * 0.001f; - mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false); + mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false, false); GetRenderController().Initialize(); @@ -200,10 +209,10 @@ bool TestGraphicsApplication::Render(uint32_t intervalMilliseconds, const char* mRenderStatus.SetNeedsUpdate(false); mRenderStatus.SetNeedsPostRender(false); - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PostRender(); mFrame++; @@ -214,7 +223,7 @@ bool TestGraphicsApplication::PreRenderWithPartialUpdate(uint32_t intervalMillis { DoUpdate(intervalMilliseconds, location); - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); mCore->PreRender(mScene, damagedRects); return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate(); @@ -224,7 +233,7 @@ bool TestGraphicsApplication::RenderWithPartialUpdate(std::vector>& da { mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/, clippingRect); mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PostRender(); mFrame++; @@ -255,10 +264,10 @@ bool TestGraphicsApplication::GetRenderNeedsPostRender() bool TestGraphicsApplication::RenderOnly() { // Update Time values - mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/); + mCore->PreRender(mRenderStatus, false /*do not force clear*/); mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/); mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/); - mCore->PostRender(false /*do not skip rendering*/); + mCore->PostRender(); mFrame++; @@ -269,7 +278,7 @@ void TestGraphicsApplication::ResetContext() { mCore->ContextDestroyed(); mGraphicsController.InitializeGLES(mGlAbstraction); - mGraphicsController.Initialize(mGlSyncAbstraction, mGlContextHelperAbstraction); + mGraphicsController.Initialize(mGraphicsSyncImplementation, mGlContextHelperAbstraction, mGraphics); mCore->ContextCreated(); }