From c9a2fee32e3468004480689d8699230c24bd304f Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 12 Jul 2024 16:35:44 +0100 Subject: Fixups following EGL refactor for Vulkan Change-Id: I55df40743f5599b2462889d03c4688bf0328ff5b --- dali/internal/adaptor/common/adaptor-impl.cpp | 10 +------ dali/internal/graphics/common/graphics-interface.h | 32 ++++++++++++---------- .../graphics/gles/egl-graphics-factory.cpp | 3 +- dali/internal/graphics/gles/egl-graphics.cpp | 5 ++++ dali/internal/graphics/gles/egl-graphics.h | 5 ++++ .../graphics/vulkan/vulkan-graphics-impl.cpp | 5 ++++ .../graphics/vulkan/vulkan-graphics-impl.h | 3 ++ .../window-system/common/window-render-surface.cpp | 2 +- .../window-system/common/window-render-surface.h | 3 -- .../window-system/macos/window-base-mac.mm | 3 +- 10 files changed, 40 insertions(+), 31 deletions(-) (limited to 'dali') diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 1c87cc57e..75d6b3534 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -888,15 +888,7 @@ Any Adaptor::GetGraphicsDisplay() if(mGraphics) { -#if defined(VULKAN_ENABLED) - //@todo Implement this! -#else - auto graphics = mGraphics.get(); - auto eglGraphics = static_cast(graphics); - - EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); - display = eglImpl.GetDisplay(); -#endif + display = mGraphics->GetDisplay(); } return display; } diff --git a/dali/internal/graphics/common/graphics-interface.h b/dali/internal/graphics/common/graphics-interface.h index 1386bfa99..dfb5f8b71 100644 --- a/dali/internal/graphics/common/graphics-interface.h +++ b/dali/internal/graphics/common/graphics-interface.h @@ -48,16 +48,15 @@ namespace Graphics { class SurfaceFactory; - /** * @brief Surface identifier * * The surface id is used as the index for windows in the vulkan implementation */ -using SurfaceId = uint32_t; -const SurfaceId INVALID_SURFACE_ID=std::numeric_limits::max(); +using SurfaceId = uint32_t; +const SurfaceId INVALID_SURFACE_ID = std::numeric_limits::max(); -enum class DepthStencilMode +enum class DepthStencilMode { /** * No depth/stencil at all @@ -80,7 +79,7 @@ enum class DepthStencilMode DEPTH_STENCIL_EXPLICIT, }; -enum class SwapchainBufferingMode +enum class SwapchainBufferingMode { OPTIMAL = 0, @@ -89,15 +88,14 @@ enum class SwapchainBufferingMode TRIPLE_BUFFERING = 3, }; - struct GraphicsCreateInfo { - uint32_t surfaceWidth; - uint32_t surfaceHeight; - DepthStencilMode depthStencilMode; - SwapchainBufferingMode swapchainBufferingMode; - ColorDepth colorDepth; - int multiSamplingLevel; + uint32_t surfaceWidth; + uint32_t surfaceHeight; + DepthStencilMode depthStencilMode; + SwapchainBufferingMode swapchainBufferingMode; + ColorDepth colorDepth; + int multiSamplingLevel; }; /** @@ -110,8 +108,8 @@ public: * Constructor */ GraphicsInterface( - const GraphicsCreateInfo& info, - Integration::DepthBufferAvailable depthBufferRequired, + const GraphicsCreateInfo& info, + Integration::DepthBufferAvailable depthBufferRequired, Integration::StencilBufferAvailable stencilBufferRequired, Integration::PartialUpdateAvailable partialUpdateRequired) : mCreateInfo(info), @@ -153,6 +151,12 @@ public: */ virtual void InitializeGraphicsAPI(const Dali::DisplayConnection& displayConnection) = 0; + /** + * Get the graphics display handle. It will be a type in the specific graphics backend, + * e.g. EGLDisplay. + */ + virtual Dali::Any GetDisplay() const = 0; + /** * Configure the graphics surface * diff --git a/dali/internal/graphics/gles/egl-graphics-factory.cpp b/dali/internal/graphics/gles/egl-graphics-factory.cpp index 156234db8..6e9536cf9 100644 --- a/dali/internal/graphics/gles/egl-graphics-factory.cpp +++ b/dali/internal/graphics/gles/egl-graphics-factory.cpp @@ -40,10 +40,9 @@ GraphicsFactory::~GraphicsFactory() Graphics::GraphicsInterface& GraphicsFactory::Create() { Graphics::GraphicsCreateInfo info{}; - auto depthBufferRequired = (mEnvironmentOptions.DepthBufferRequired() ? Integration::DepthBufferAvailable::TRUE : Integration::DepthBufferAvailable::FALSE); + auto depthBufferRequired = (mEnvironmentOptions.DepthBufferRequired() ? Integration::DepthBufferAvailable::TRUE : Integration::DepthBufferAvailable::FALSE); auto stencilBufferRequired = (mEnvironmentOptions.StencilBufferRequired() ? Integration::StencilBufferAvailable::TRUE : Integration::StencilBufferAvailable::FALSE); - auto partialUpdateRequired = (mEnvironmentOptions.PartialUpdateRequired() ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE); info.multiSamplingLevel = mEnvironmentOptions.GetMultiSamplingLevel(); diff --git a/dali/internal/graphics/gles/egl-graphics.cpp b/dali/internal/graphics/gles/egl-graphics.cpp index 8bb67ef30..8fc0be556 100644 --- a/dali/internal/graphics/gles/egl-graphics.cpp +++ b/dali/internal/graphics/gles/egl-graphics.cpp @@ -176,6 +176,11 @@ void EglGraphics::InitializeGraphicsAPI(const Dali::DisplayConnection& displayCo mEglImplementation->InitializeGles(eglDisplay); } +Dali::Any EglGraphics::GetDisplay() const +{ + return {mEglImplementation->GetDisplay()}; +} + void EglGraphics::EglInitialize() { mEglSync = Utils::MakeUnique(); diff --git a/dali/internal/graphics/gles/egl-graphics.h b/dali/internal/graphics/gles/egl-graphics.h index 3ede061ef..09ab88e89 100644 --- a/dali/internal/graphics/gles/egl-graphics.h +++ b/dali/internal/graphics/gles/egl-graphics.h @@ -71,6 +71,11 @@ public: */ void InitializeGraphicsAPI(const Dali::DisplayConnection& displayConnection) override; + /** + * @copydoc Dali::Graphics::GraphicsInterface::GetDisplay() + */ + Dali::Any GetDisplay() const override; + /** * @copydoc Dali::Graphics::GraphicsInterface::CreateSurface() */ diff --git a/dali/internal/graphics/vulkan/vulkan-graphics-impl.cpp b/dali/internal/graphics/vulkan/vulkan-graphics-impl.cpp index 22133a801..8784003d8 100644 --- a/dali/internal/graphics/vulkan/vulkan-graphics-impl.cpp +++ b/dali/internal/graphics/vulkan/vulkan-graphics-impl.cpp @@ -67,6 +67,11 @@ void VulkanGraphics::InitializeGraphicsAPI(const Dali::DisplayConnection& displa // Not needed for xlib-xcb surface creation... } +Dali::Any VulkanGraphics::GetDisplay() const +{ + return {}; // We don't have a display equivalent for vulkan. +} + void VulkanGraphics::ConfigureSurface(Dali::Integration::RenderSurfaceInterface* surface) { surface->InitializeGraphics(); // Calls CreateSurface below diff --git a/dali/internal/graphics/vulkan/vulkan-graphics-impl.h b/dali/internal/graphics/vulkan/vulkan-graphics-impl.h index bf926a1d8..e412d8b03 100644 --- a/dali/internal/graphics/vulkan/vulkan-graphics-impl.h +++ b/dali/internal/graphics/vulkan/vulkan-graphics-impl.h @@ -47,8 +47,11 @@ public: void Initialize(const Dali::DisplayConnection& displayConnection) override; void Initialize(const Dali::DisplayConnection& displayConnection, bool depth, bool stencil, bool partialRendering, int msaa) override; + void InitializeGraphicsAPI(const Dali::DisplayConnection& displayConnection) override; + Dali::Any GetDisplay() const override; + void ConfigureSurface(Dali::Integration::RenderSurfaceInterface* surface) override; Graphics::SurfaceId CreateSurface( diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index 146eeb0c8..6b7fbbb77 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -486,7 +486,7 @@ bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector PreRotation * wl_egl_window_tizen_set_buffer_transform(SetWindowBufferTransform) -> Screen Rotation * wl_egl_window_tizen_set_window_transform(SetWindowTransform) -> Window Rotation diff --git a/dali/internal/window-system/common/window-render-surface.h b/dali/internal/window-system/common/window-render-surface.h index 49241cc69..427df1ba3 100644 --- a/dali/internal/window-system/common/window-render-surface.h +++ b/dali/internal/window-system/common/window-render-surface.h @@ -353,9 +353,6 @@ private: using FrameCallbackInfoContainer = std::vector>; private: // Data - // EglInterface* mEGL; - // EGLSurface mEGLSurface; - // EGLContext mEGLContext; Dali::DisplayConnection* mDisplayConnection; PositionSize mPositionSize; ///< Position std::unique_ptr mWindowBase; diff --git a/dali/internal/window-system/macos/window-base-mac.mm b/dali/internal/window-system/macos/window-base-mac.mm index 5c0af5dac..a9b72ab6b 100644 --- a/dali/internal/window-system/macos/window-base-mac.mm +++ b/dali/internal/window-system/macos/window-base-mac.mm @@ -407,8 +407,7 @@ Dali::Any WindowBaseCocoa::CreateWindow(int width, int height) { // XXX: this method is called from a secondary thread, but // we can only resize the window from the main thread - //PositionSize size(0, 0, width, height); - //Resize(size); + return static_cast(mImpl->mWindow.contentView.layer); } -- cgit v1.2.3