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
42 virtual ~GlViewImpl() = default;
46 * Construct a new GlView.
48 explicit GlViewImpl(GlView::BackendMode backendMode)
49 : Control(ControlBehaviour(0u | ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
50 mBackendMode(backendMode)
55 * @copydoc Dali::Toolkit::GlView::RegisterGlCallbacks()
57 virtual void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback) = 0;
60 * @copydoc Dali::Toolkit::GlView::SetResizeCallback()
62 virtual void SetResizeCallback(CallbackBase* resizeCallback) = 0;
65 * @copydoc Dali::Toolkit::GlView::SetGraphisConfig()
67 virtual bool SetGraphicsConfig(bool depth, bool stencil, int msaa, Dali::Toolkit::GlView::GraphicsApiVersion version) = 0;
70 * @copydoc Dali::Toolkit::GlView::SetRenderingMode()
72 virtual void SetRenderingMode(Dali::Toolkit::GlView::RenderingMode mode) = 0;
75 * @copydoc Dali::Toolkit::GlView::GetRenderingMode()
77 virtual Dali::Toolkit::GlView::RenderingMode GetRenderingMode() const = 0;
80 * @copydoc Dali::Toolkit::GlView::GetBackendMode()
82 [[nodiscard]] Dali::Toolkit::GlView::BackendMode GetBackendMode() const
88 * @copydoc Dali::Toolkit::GlView::RenderOnce()
90 virtual void RenderOnce() = 0;
93 * @copydoc Dali::Toolkit::GlView::BindTextureResources()
95 virtual void BindTextureResources(std::vector<Dali::Texture> textures) = 0;
97 private: // From Control
99 * @copydoc Toolkit::Control::OnInitialize()
101 virtual void OnInitialize() override = 0;
104 * @copydoc Toolkit::Control::OnSceneConnection()
106 virtual void OnSceneConnection(int depth) override = 0;
109 * @copydoc Toolkit::Control::OnSceneDisconnection()
111 virtual void OnSceneDisconnection() override = 0;
114 GlView::BackendMode mBackendMode{GlView::BackendMode::DEFAULT}; ///< Implementation backend mode (DirectRendering, EGL image)
117 } // namespace Internal
119 inline Dali::Toolkit::Internal::GlViewImpl& GetImpl(Dali::Toolkit::GlView& handle)
121 DALI_ASSERT_ALWAYS(handle);
122 Dali::RefObject& impl = handle.GetImplementation();
123 return static_cast<Dali::Toolkit::Internal::GlViewImpl&>(impl);
126 inline const Dali::Toolkit::Internal::GlViewImpl& GetImpl(const Dali::Toolkit::GlView& handle)
128 DALI_ASSERT_ALWAYS(handle);
129 const Dali::RefObject& impl = handle.GetImplementation();
130 return static_cast<const Dali::Toolkit::Internal::GlViewImpl&>(impl);
133 } // namespace Dali::Toolkit
135 #endif // DALI_TOOLKIT_INTERNAL_GL_VIEW_IMPL_H