1 #ifndef DALI_TOOLKIT_INTERNAL_GL_VIEW_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_GL_VIEW_IMPL_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/devel-api/adaptor-framework/native-image-source-queue.h>
24 #include <dali/public-api/adaptor-framework/window.h>
25 #include <dali/public-api/rendering/geometry.h>
26 #include <dali/public-api/rendering/shader.h>
29 #include <dali-toolkit/internal/controls/gl-view/gl-view-render-thread.h>
30 #include <dali-toolkit/public-api/controls/control-impl.h>
31 #include <dali-toolkit/public-api/controls/gl-view/gl-view.h>
33 namespace Dali::Toolkit
39 class GlViewImpl : public Dali::Toolkit::Internal::Control
43 virtual ~GlViewImpl() = default;
48 * Construct a new GlView.
50 explicit GlViewImpl( GlView::BackendMode backendMode ) :
51 Control(ControlBehaviour(0u | ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
52 mBackendMode(backendMode)
57 * @copydoc Dali::Toolkit::GlView::RegisterGlCallbacks()
59 virtual void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback) = 0;
62 * @copydoc Dali::Toolkit::GlView::SetResizeCallback()
64 virtual void SetResizeCallback(CallbackBase* resizeCallback) = 0;
67 * @copydoc Dali::Toolkit::GlView::SetGraphisConfig()
69 virtual bool SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::Toolkit::GlView::GraphicsApiVersion version) = 0;
72 * @copydoc Dali::Toolkit::GlView::SetRenderingMode()
74 virtual void SetRenderingMode(Dali::Toolkit::GlView::RenderingMode mode) = 0;
77 * @copydoc Dali::Toolkit::GlView::GetRenderingMode()
79 virtual Dali::Toolkit::GlView::RenderingMode GetRenderingMode() const = 0;
82 * @copydoc Dali::Toolkit::GlView::GetBackendMode()
84 [[nodiscard]] Dali::Toolkit::GlView::BackendMode GetBackendMode() const
90 * @copydoc Dali::Toolkit::GlView::RenderOnce()
92 virtual void RenderOnce() = 0;
94 private: // From Control
96 * @copydoc Toolkit::Control::OnInitialize()
98 virtual void OnInitialize() override = 0;
101 * @copydoc Toolkit::Control::OnSceneConnection()
103 virtual void OnSceneConnection(int depth) override = 0;
106 * @copydoc Toolkit::Control::OnSceneDisconnection()
108 virtual void OnSceneDisconnection() override = 0;
112 GlView::BackendMode mBackendMode { GlView::BackendMode::DEFAULT }; ///< Implementation backend mode (DirectRendering, EGL image)
115 } // namespace Internal
117 inline Dali::Toolkit::Internal::GlViewImpl& GetImpl(Dali::Toolkit::GlView& handle)
119 DALI_ASSERT_ALWAYS(handle);
120 Dali::RefObject& impl = handle.GetImplementation();
121 return static_cast<Dali::Toolkit::Internal::GlViewImpl&>(impl);
124 inline const Dali::Toolkit::Internal::GlViewImpl& GetImpl(const Dali::Toolkit::GlView& handle)
126 DALI_ASSERT_ALWAYS(handle);
127 const Dali::RefObject& impl = handle.GetImplementation();
128 return static_cast<const Dali::Toolkit::Internal::GlViewImpl&>(impl);
133 #endif // DALI_TOOLKIT_INTERNAL_GL_VIEW_IMPL_H