1 #ifndef DALI_PROJECT_DRAWABLE_VIEW_NATIVE_RENDERER_H
2 #define DALI_PROJECT_DRAWABLE_VIEW_NATIVE_RENDERER_H
5 * Copyright (c) 2024 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.
21 #include <dali/public-api/signals/callback.h>
22 #include <dali/public-api/signals/render-callback.h>
26 namespace Dali::Internal
29 * The structure containing the initialization data for the
30 * DrawableViewNativeRenderer instance.
32 struct NativeRendererCreateInfo
35 * Presentation mode is used only for threaded renderer
37 enum class PresentationMode
39 FIFO, // First-in first-out
40 MAILBOX // Only most recent out
43 bool threadEnabled { false };
44 bool directExecution { false };
46 uint32_t maxOffscreenBuffers { 3u };
47 PresentationMode presentationMode {PresentationMode::FIFO};
51 * The DrawableViewNativeRenderer is responsible for delegating rendering
52 * either to the own thread (in parallel mode) or calling the GlView render callbacks
55 * The parallel mode creates the thread that invokes GLView callbacks directly.
56 * The actual render callback will only pass the input data and blit the result.
58 * Parallel mode renders always to the offscreen framebuffer.
60 class DrawableViewNativeRenderer
63 explicit DrawableViewNativeRenderer( const NativeRendererCreateInfo& createInfo );
64 ~DrawableViewNativeRenderer();
67 * Registers GlView callbacks
69 void RegisterGlCallbacks( Dali::CallbackBase* onInitCallback,Dali::CallbackBase* onRenderCallback, Dali::CallbackBase* onTerminateCallback );
72 * Dispatches the GlView init callback
73 * @param renderCallbackInput
75 void InvokeGlInitCallback( const RenderCallbackInput& renderCallbackInput );
78 * Dispatches the GlView render callback
79 * @param renderCallbackInput
81 void InvokeGlRenderCallback( const RenderCallbackInput& renderCallbackInput );
84 * Dispatches the GlView terminate callback
85 * @param[in] renderCallbackInput
87 void InvokeGlTerminateCallback( const RenderCallbackInput& renderCallbackInput );
90 * @brief Resizes the render surface
92 * @param[in] width Width of surface
93 * @param[in] height Height of surface
95 void Resize( uint32_t width, uint32_t height );
98 * @brief Pushes render callback input data into the native renderer thread
100 * @param[in] renderCallbackInput Valid RenderCallbackInput object
102 void PushRenderCallbackInputData( const Dali::RenderCallbackInput& renderCallbackInput );
105 * @brief Terminates thread in parallel mode
112 std::unique_ptr<Impl> mImpl;
116 #endif // DALI_PROJECT_DRAWABLE_VIEW_NATIVE_RENDERER_H