From 2c2bf30a2c1079222102b6323044ed5d3a303259 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 31 Jan 2024 18:56:41 +0000 Subject: [PATCH] [Tizen] GraphicsBackend clean up backport This is a combination of 2 commits. Removing old temporary graphics APIs Change-Id: I41c5af839ab5b0807194ebe2ecedbbaa27ba033c Remove inclusion of gl-abstraction.h Remove all #includes. Would like to move this abstraction to dali-adaptor, but many tests use the test-gl-abstraction layer to check that e.g. uniforms have been written. Instead, they should be modified to use the test graphics layer, but that's a lot of work :/. So, have just removed the usage, but left the file there. Change-Id: I16f4945eb54ede451f4c91ee130284e84d653309 Signed-off-by: David Steele --- .../dali-test-suite-utils/test-application.cpp | 7 +-- .../dali/dali-test-suite-utils/test-application.h | 3 +- .../test-gl-context-helper-abstraction.h | 64 ------------------- .../test-graphics-controller.h | 10 ++- dali/graphics-api/graphics-controller.h | 16 ++--- dali/integration-api/bitmap.cpp | 3 +- dali/integration-api/core.h | 5 +- dali/integration-api/file.list | 2 +- dali/integration-api/gl-abstraction.h | 6 +- .../gl-context-helper-abstraction.h | 59 ------------------ dali/integration-api/graphics-config.h | 71 ++++++++++++++++++++++ dali/internal/common/core-impl.cpp | 9 +-- dali/internal/common/core-impl.h | 10 ++- .../internal/event/common/thread-local-storage.cpp | 11 ++-- 14 files changed, 103 insertions(+), 173 deletions(-) delete mode 100644 automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h delete mode 100644 dali/integration-api/gl-context-helper-abstraction.h create mode 100644 dali/integration-api/graphics-config.h diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp index 47487e2..496fc3b 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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. @@ -163,11 +163,6 @@ TestGlAbstraction& TestApplication::GetGlAbstraction() return static_cast(mGraphicsController.GetGlAbstraction()); } -TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction() -{ - return static_cast(mGraphicsController.GetGlContextHelperAbstraction()); -} - TestGraphicsSyncImplementation& TestApplication::GetGraphicsSyncImpl() { return static_cast(mGraphicsController.GetGraphicsSyncImpl()); diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-application.h b/automated-tests/src/dali/dali-test-suite-utils/test-application.h index 5e86b3c..555822d 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-application.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-application.h @@ -2,7 +2,7 @@ #define DALI_TEST_APPLICATION_H /* - * Copyright (c) 2023 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. @@ -67,7 +67,6 @@ public: TestGraphicsController& GetGraphicsController(); TestGlAbstraction& GetGlAbstraction(); - TestGlContextHelperAbstraction& GetGlContextHelperAbstraction(); TestGraphicsSyncImplementation& GetGraphicsSyncImpl(); void ProcessEvent(const Integration::Event& event); diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h deleted file mode 100644 index 1a5a54c..0000000 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-context-helper-abstraction.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef TEST_GL_CONTEXT_HELPER_ABSTRACTION_H -#define TEST_GL_CONTEXT_HELPER_ABSTRACTION_H - -/* - * Copyright (c) 2020 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ -/** - * Class to emulate the GL context helper - */ -class DALI_CORE_API TestGlContextHelperAbstraction : public Integration::GlContextHelperAbstraction -{ -public: - /** - * Constructor - */ - TestGlContextHelperAbstraction(){}; - - /** - * Destructor - */ - ~TestGlContextHelperAbstraction() override{}; - - /** - * @brief Switch to the surfaceless GL context - */ - void MakeSurfacelessContextCurrent() override{}; - - /** - * @brief Clear the GL context - */ - void MakeContextNull() override{}; - - /** - * @brief Wait until all GL rendering calls for the current GL context are executed - */ - void WaitClient() override{}; - -private: - TestGlContextHelperAbstraction(const TestGlContextHelperAbstraction&); ///< Undefined - TestGlContextHelperAbstraction& operator=(const TestGlContextHelperAbstraction&); ///< Undefined -}; - -} // namespace Dali - -#endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.h b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.h index e14499b..6066f67 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-graphics-controller.h @@ -2,7 +2,7 @@ #define TEST_GRAPHICS_CONTROLLER_H /* - * Copyright (c) 2023 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. @@ -20,7 +20,6 @@ #include #include #include "test-gl-abstraction.h" -#include "test-gl-context-helper-abstraction.h" #include "test-graphics-command-buffer.h" #include "test-graphics-program.h" #include "test-graphics-reflection.h" @@ -104,14 +103,14 @@ public: mGl.Initialize(); } - Integration::GlAbstraction& GetGlAbstraction() override + Integration::GlAbstraction& GetGlAbstraction() { return mGl; } - Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override + Integration::GraphicsConfig& GetGraphicsConfig() { - return mGlContextHelperAbstraction; + return mGl; } TestGraphicsSyncImplementation& GetGraphicsSyncImpl() @@ -465,7 +464,6 @@ public: TestGlAbstraction mGl; TestGraphicsSyncImplementation mGraphicsSyncImpl; - TestGlContextHelperAbstraction mGlContextHelperAbstraction; bool isDiscardQueueEmptyResult{true}; bool isDrawOnResumeRequiredResult{true}; diff --git a/dali/graphics-api/graphics-controller.h b/dali/graphics-api/graphics-controller.h index 1395671..0ca8bf5 100644 --- a/dali/graphics-api/graphics-controller.h +++ b/dali/graphics-api/graphics-controller.h @@ -2,7 +2,7 @@ #define DALI_GRAPHICS_CONTROLLER_H /* - * Copyright (c) 2023 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. @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include @@ -40,12 +41,6 @@ namespace Dali { -namespace Integration -{ -class GlAbstraction; -class GlContextHelperAbstraction; -} // namespace Integration - namespace Graphics { class Command; @@ -70,9 +65,10 @@ class Texture; class Controller { public: - // Temporary until graphics api is complete - virtual Integration::GlAbstraction& GetGlAbstraction() = 0; - virtual Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() = 0; + /** + * Get graphics configuration for info about the graphics subsystem. + */ + virtual Integration::GraphicsConfig& GetGraphicsConfig() = 0; /** * @brief Destroys controller diff --git a/dali/integration-api/bitmap.cpp b/dali/integration-api/bitmap.cpp index 70db04b..bab8f5a 100644 --- a/dali/integration-api/bitmap.cpp +++ b/dali/integration-api/bitmap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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. @@ -20,7 +20,6 @@ // INTERNAL INCLUDES #include -#include #include #include #include diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index c851127..4431884 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_CORE_H /* - * Copyright (c) 2023 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. @@ -183,7 +183,7 @@ private: * Integration::Core is used for integration with the native windowing system. * The following integration tasks must be completed: * - * 1) Handle GL context creation, and notify the Core when this occurs. + * 1) Handle Graphics context creation, and notify the Core when this occurs. * * 2) Provide suspend/resume behaviour (see below for more details). * @@ -195,7 +195,6 @@ private: * * 5) Provide an implementation of the PlatformAbstraction interface, used to access platform specific services. * - * 6) Provide an implementation of the GlAbstraction interface, used to access OpenGL services. * * Multi-threading notes: * diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 1059719..be358ac 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -37,8 +37,8 @@ SET( platform_abstraction_header_files ${platform_abstraction_src_dir}/core-enumerations.h ${platform_abstraction_src_dir}/debug.h ${platform_abstraction_src_dir}/gl-abstraction.h - ${platform_abstraction_src_dir}/gl-context-helper-abstraction.h ${platform_abstraction_src_dir}/gl-defines.h + ${platform_abstraction_src_dir}/graphics-config.h ${platform_abstraction_src_dir}/graphics-sync-abstraction.h ${platform_abstraction_src_dir}/input-options.h ${platform_abstraction_src_dir}/lockless-buffer.h diff --git a/dali/integration-api/gl-abstraction.h b/dali/integration-api/gl-abstraction.h index 7a5a598..f085354 100644 --- a/dali/integration-api/gl-abstraction.h +++ b/dali/integration-api/gl-abstraction.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_GL_ABSTRACTION_H /* - * Copyright (c) 2022 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. @@ -47,6 +47,8 @@ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ +#include + /* OpenGL ES 3.0 */ struct __GLsync; @@ -91,7 +93,7 @@ namespace Integration * A concrete implementation must be created for each platform, and provided when creating the * Dali::Integration::Core object. */ -class GlAbstraction +class GlAbstraction : public GraphicsConfig { protected: // Protected construction & deletion diff --git a/dali/integration-api/gl-context-helper-abstraction.h b/dali/integration-api/gl-context-helper-abstraction.h deleted file mode 100644 index 4e2e4e7..0000000 --- a/dali/integration-api/gl-context-helper-abstraction.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef DALI_INTEGRATION_GL_CONTEXT_HELPER_ABSTRACTION_H -#define DALI_INTEGRATION_GL_CONTEXT_HELPER_ABSTRACTION_H - -/* - * Copyright (c) 2020 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ -namespace Integration -{ -/** - * This abstraction defines the interface for accessing GL context. - */ -class GlContextHelperAbstraction -{ -protected: - /** - * Virtual protected destructor, no deletion through this interface - */ - virtual ~GlContextHelperAbstraction() = default; - -public: - /** - * @brief Switch to the surfaceless GL context - */ - virtual void MakeSurfacelessContextCurrent() = 0; - - /** - * @brief Clear the GL context - */ - virtual void MakeContextNull() = 0; - - /** - * @brief Wait until all GL rendering calls for the current GL context are executed - */ - virtual void WaitClient() = 0; -}; - -} // namespace Integration -} // namespace Dali - -#endif // DALI_INTEGRATION_GL_CONTEXT_HELPER_ABSTRACTION_H diff --git a/dali/integration-api/graphics-config.h b/dali/integration-api/graphics-config.h new file mode 100644 index 0000000..e0b3ddb --- /dev/null +++ b/dali/integration-api/graphics-config.h @@ -0,0 +1,71 @@ +#ifndef DALI_INTEGRATION_GRAPHICS_CONFIG_H +#define DALI_INTEGRATION_GRAPHICS_CONFIG_H + +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +namespace Dali::Integration +{ +/** + * GraphicsConfig is an abstract interface, used to access OpenGRAPHICS services. + * A concrete implementation must be created for each platform, and provided when creating the + * Dali::Integration::Core object. + */ +class GraphicsConfig +{ +protected: + // Protected construction & deletion + GraphicsConfig() = default; ///< Protected constructor so an instance of this class cannot be created. + virtual ~GraphicsConfig() = default; ///< Virtual protected destructor, no deletion through this interface. + +public: + // Not copyable but movable + GraphicsConfig(const GraphicsConfig&) = delete; ///< Deleted copy constructor. + GraphicsConfig(GraphicsConfig&&) = default; ///< Default move constructor. + GraphicsConfig& operator=(const GraphicsConfig&) = delete; ///< Deleted copy assignment operator. + GraphicsConfig& operator=(GraphicsConfig&&) = default; ///< Default move assignment operator. + + /** + * Returns current graphicses can support the blend equation + * @Return true current graphicses support the blend equation + */ + virtual bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) = 0; + + /** + * Returns shader prefix of shading language version. + * @Return shader prefix of shading language version. + */ + virtual std::string GetShaderVersionPrefix() = 0; + + /** + * Returns vertex shader prefix including shading language version. + * @Return vertex shader prefix including shading language version. + */ + virtual std::string GetVertexShaderPrefix() = 0; + + /** + * Returns fragment shader prefix including shading language version and extension information. + * @Return fragment shader prefix including shading language version and extension information. + */ + virtual std::string GetFragmentShaderPrefix() = 0; +}; + +} // namespace Dali::Integration + +#endif diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 3d61851..461d2eb 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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. @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -71,8 +70,6 @@ namespace Dali namespace Internal { using Integration::Event; -using Integration::GlAbstraction; -using Integration::GlContextHelperAbstraction; using Integration::PlatformAbstraction; using Integration::RenderController; using Integration::RenderStatus; @@ -640,9 +637,9 @@ AnimationPlaylist& Core::GetAnimationPlaylist() const return *(mAnimationPlaylist); } -Integration::GlAbstraction& Core::GetGlAbstraction() const +Integration::GraphicsConfig& Core::GetGraphicsConfig() const { - return mGraphicsController.GetGlAbstraction(); + return mGraphicsController.GetGraphicsConfig(); } void Core::AddScene(Scene* scene) diff --git a/dali/internal/common/core-impl.h b/dali/internal/common/core-impl.h index 754869c..e7a2a86 100644 --- a/dali/internal/common/core-impl.h +++ b/dali/internal/common/core-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_CORE_H /* - * Copyright (c) 2023 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. @@ -41,7 +41,6 @@ namespace Integration { class Processor; class RenderController; -class GlAbstraction; class PlatformAbstraction; class UpdateStatus; class RenderStatus; @@ -318,11 +317,10 @@ private: AnimationPlaylist& GetAnimationPlaylist() const; /** - * @brief Returns GlAbstraction. - * @note Use only for the capability. Do not use this for bypass context - * @return GlAbstraction + * @brief Returns GraphicsConfig + * @return A reference to the GraphicsConfig struct. */ - Integration::GlAbstraction& GetGlAbstraction() const; + Integration::GraphicsConfig& GetGraphicsConfig() const; private: /** diff --git a/dali/internal/event/common/thread-local-storage.cpp b/dali/internal/event/common/thread-local-storage.cpp index 077355d..2cbab57 100644 --- a/dali/internal/event/common/thread-local-storage.cpp +++ b/dali/internal/event/common/thread-local-storage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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. @@ -19,7 +19,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include @@ -162,22 +161,22 @@ AnimationPlaylist& ThreadLocalStorage::GetAnimationPlaylist() bool ThreadLocalStorage::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) { - return mCore->GetGlAbstraction().IsBlendEquationSupported(blendEquation); + return mCore->GetGraphicsConfig().IsBlendEquationSupported(blendEquation); } std::string ThreadLocalStorage::GetShaderVersionPrefix() { - return mCore->GetGlAbstraction().GetShaderVersionPrefix(); + return mCore->GetGraphicsConfig().GetShaderVersionPrefix(); } std::string ThreadLocalStorage::GetVertexShaderPrefix() { - return mCore->GetGlAbstraction().GetVertexShaderPrefix(); + return mCore->GetGraphicsConfig().GetVertexShaderPrefix(); } std::string ThreadLocalStorage::GetFragmentShaderPrefix() { - return mCore->GetGlAbstraction().GetFragmentShaderPrefix(); + return mCore->GetGraphicsConfig().GetFragmentShaderPrefix(); } void ThreadLocalStorage::AddScene(Scene* scene) -- 2.7.4