/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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 "test-graphics-application.h"
+#include <test-graphics-sync-impl.h>
namespace Dali
{
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);
mCore = Dali::Integration::Core::New(mRenderController,
mPlatformAbstraction,
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");
}
{
mScene = Dali::Integration::Scene::New(Size(static_cast<float>(mSurfaceWidth), static_cast<float>(mSurfaceHeight)));
mScene.SetDpi(Vector2(static_cast<float>(mDpi.x), static_cast<float>(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()
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 : "");
}
}
{
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:
return static_cast<TestGlAbstraction&>(mGraphicsController.GetGlAbstraction());
}
-TestGlSyncAbstraction& TestGraphicsApplication::GetGlSyncAbstraction()
-{
- return static_cast<TestGlSyncAbstraction&>(mGraphicsController.GetGlSyncAbstraction());
-}
-
TestGlContextHelperAbstraction& TestGraphicsApplication::GetGlContextHelperAbstraction()
{
return static_cast<TestGlContextHelperAbstraction&>(mGraphicsController.GetGlContextHelperAbstraction());
uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
float elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
- mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
+ mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false, false);
GetRenderController().Initialize();
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++;
{
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();
{
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++;
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++;
{
mCore->ContextDestroyed();
mGraphicsController.InitializeGLES(mGlAbstraction);
- mGraphicsController.Initialize(mGlSyncAbstraction, mGlContextHelperAbstraction);
+ mGraphicsController.Initialize(mGraphicsSyncImplementation, mGlContextHelperAbstraction, mGraphics);
mCore->ContextCreated();
}