#define DALI_TEST_GRAPHICS_APPLICATION_H
/*
- * 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 <dali/integration-api/scene.h>
#include <dali/integration-api/trace.h>
+#include <dali/internal/graphics/common/graphics-interface.h>
#include <dali/internal/graphics/gles-impl/egl-graphics-controller.h>
#include <dali/public-api/common/dali-common.h>
#include <test-gl-abstraction.h>
#include <test-gl-context-helper-abstraction.h>
-#include <test-gl-sync-abstraction.h>
+#include <test-graphics-sync-impl.h>
#include <test-platform-abstraction.h>
#include <test-render-controller.h>
namespace Dali
{
+namespace Internal::Adaptor
+{
+class ConfigurationManager;
+}
+
+class TestGraphicsImpl : public Internal::Adaptor::GraphicsInterface
+{
+public:
+ TestGraphicsImpl()
+ : GraphicsInterface()
+ {
+ }
+ virtual ~TestGraphicsImpl() = default;
+
+ Dali::Graphics::Controller& GetController() override
+ {
+ Dali::Graphics::Controller* controller{nullptr};
+ return *controller;
+ }
+
+ /**
+ * Initialize the graphics subsystem, configured from environment
+ */
+ void Initialize() override
+ {
+ mCallstack.PushCall("Initialize()", "");
+ }
+
+ /**
+ * Initialize the graphics subsystem, providing explicit parameters.
+ *
+ * @param[in] depth True if depth buffer is required
+ * @param[in] stencil True if stencil buffer is required
+ * @param[in] partialRendering True if partial rendering is required
+ * @param[in] msaa level of anti-aliasing required (-1 = off)
+ */
+ void Initialize(bool depth, bool stencil, bool partialRendering, int msaa) override
+ {
+ TraceCallStack::NamedParams namedParams;
+ namedParams["depth"] << depth;
+ namedParams["stencil"] << stencil;
+ namedParams["partialRendering"] << partialRendering;
+ namedParams["msaa"] << msaa;
+ mCallstack.PushCall("Initialize()", "");
+ }
+
+ /**
+ * Configure the graphics surface
+ *
+ * @param[in] surface The surface to configure, or NULL if not present
+ */
+ void ConfigureSurface(Dali::RenderSurfaceInterface* surface) override
+ {
+ }
+
+ /**
+ * Activate the resource context
+ */
+ void ActivateResourceContext() override
+ {
+ mCallstack.PushCall("ActivateResourceContext()", "");
+ }
+
+ /**
+ * Activate the resource context
+ *
+ * @param[in] surface The surface whose context to be switched to.
+ */
+ void ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface) override
+ {
+ TraceCallStack::NamedParams namedParams;
+ namedParams["surface"] << std::hex << surface;
+ mCallstack.PushCall("ActivateResourceContext()", namedParams.str(), namedParams);
+ }
+
+ void PostRender() override
+ {
+ mCallstack.PushCall("PostRender()", "");
+ }
+
+ /**
+ * Inform graphics interface that this is the first frame after a resume.
+ */
+ void SetFirstFrameAfterResume() override
+ {
+ }
+
+ /**
+ * Shut down the graphics implementation
+ */
+ void Shutdown() override
+ {
+ mCallstack.PushCall("Shutdown()", "");
+ }
+
+ /**
+ * Destroy the Graphics implementation
+ */
+ void Destroy() override
+ {
+ mCallstack.PushCall("Destroy()", "");
+ }
+
+ /**
+ * @return true if advanced blending options are supported
+ */
+ bool IsAdvancedBlendEquationSupported() override
+ {
+ return true;
+ }
+
+ /**
+ * @return true if multisampled render to texture is supported
+ */
+ bool IsMultisampledRenderToTextureSupported() override
+ {
+ return true;
+ }
+
+ /**
+ * @return true if graphics subsystem is initialized
+ */
+ bool IsInitialized() override
+ {
+ return true;
+ }
+
+ /**
+ * @return true if a separate resource context is supported
+ */
+ bool IsResourceContextSupported() override
+ {
+ return true;
+ }
+
+ /**
+ * @return the maximum texture size
+ */
+ uint32_t GetMaxTextureSize() override
+ {
+ return 32768u;
+ }
+
+ uint32_t GetMaxCombinedTextureUnits() override
+ {
+ return 96;
+ }
+
+ /**
+ * @return the maximum texture samples when we use multisampled texture
+ */
+ uint8_t GetMaxTextureSamples() override
+ {
+ return 8u;
+ }
+
+ /**
+ * @return the version number of the shader language
+ */
+ uint32_t GetShaderLanguageVersion() override
+ {
+ return 320;
+ }
+
+ void FrameStart() override
+ {
+ }
+
+ void LogMemoryPools() override
+ {
+ }
+
+ /**
+ * Store cached configurations
+ */
+ void CacheConfigurations(Internal::Adaptor::ConfigurationManager& configurationManager) override
+ {
+ }
+
+public:
+ TraceCallStack mCallstack{true, "GraphicsImpl"};
+};
+
class DALI_CORE_API TestGraphicsApplication : public ConnectionTracker
{
public:
void InitializeCore();
~TestGraphicsApplication() override;
static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
- static void LogContext(bool start, const char* tag);
+ static void LogContext(bool start, const char* tag, const char* message);
Dali::Integration::Core& GetCore();
TestPlatformAbstraction& GetPlatform();
TestRenderController& GetRenderController();
Graphics::Controller& GetGraphicsController();
TestGlAbstraction& GetGlAbstraction();
- TestGlSyncAbstraction& GetGlSyncAbstraction();
TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
void ProcessEvent(const Integration::Event& event);
void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
protected:
- TestPlatformAbstraction mPlatformAbstraction;
- TestRenderController mRenderController;
- Graphics::EglGraphicsController mGraphicsController; // Use real controller in Adaptor
- TestGlAbstraction mGlAbstraction;
- TestGlSyncAbstraction mGlSyncAbstraction;
- TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+ TestPlatformAbstraction mPlatformAbstraction;
+ TestRenderController mRenderController;
+ Graphics::EglGraphicsController mGraphicsController; // Use real controller in Adaptor
+ TestGlAbstraction mGlAbstraction;
+ TestGlContextHelperAbstraction mGlContextHelperAbstraction;
+ TestGraphicsSyncImplementation mGraphicsSyncImplementation;
+ TestGraphicsImpl mGraphics;
+ Graphics::UniquePtr<Graphics::RenderTarget> mRenderTarget{nullptr};
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;