#define DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * 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.
class GlSyncAbstraction;
class GlContextHelperAbstraction;
class RenderStatus;
+class Scene;
}
struct Vector4;
class RenderInstructionContainer;
class Shader;
class PropertyBufferDataProvider;
+class Scene;
/**
* RenderManager is responsible for rendering the result of the previous "update", which
*/
void SetShaderSaver( ShaderSaver& upstream );
- /**
- * Retrieve the render instructions; these should be set during each "update" traversal.
- * @return The render instruction container.
- */
- RenderInstructionContainer& GetRenderInstructionContainer();
-
// The following methods should be called via RenderQueue messages
- /**
- * Set the background color i.e. the glClear color used at the beginning of each frame.
- * @param[in] color The new background color.
- */
- void SetBackgroundColor( const Vector4& color );
-
/*
* Set the frame time delta (time elapsed since the last frame.
* @param[in] deltaTime the delta time
void SetDefaultSurfaceRect( const Rect<int>& rect );
/**
+ * Returns the orintation for the default surface (probably the application window).
+ * @return Orientation for the surface.
+ */
+ void SetDefaultSurfaceOrientation( int orientation );
+
+ /**
* Add a Renderer to the render manager.
* @param[in] renderer The renderer to add.
* @post renderer is owned by RenderManager
void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
+ * Attach a texture as depth output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * Attach a texture as depth/stencil output to an existing FrameBuffer
+ * @param[in] frameBuffer The FrameBuffer
+ * @param[in] texture The texture that will be used as output when rendering
+ * @param[in] mipmapLevel The mipmap of the texture to be attached
+ */
+ void AttachDepthStencilTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * Initializes a Scene to the render manager
+ * @param[in] scene The Scene to initialize
+ */
+ void InitializeScene( SceneGraph::Scene* scene );
+
+ /**
+ * Uninitializes a Scene to the render manager
+ * @param[in] scene The Scene to uninitialize
+ */
+ void UninitializeScene( SceneGraph::Scene* scene );
+
+ /**
+ * This is called when the surface of the scene has been replaced.
+ * @param[in] scene The scene.
+ */
+ void SurfaceReplaced( SceneGraph::Scene* scene );
+
+ /**
* Adds a render tracker to the RenderManager. RenderManager takes ownership of the
* tracker. The lifetime of the tracker is related to the lifetime of the tracked
* object, usually an offscreen render task.
*/
ProgramCache* GetProgramCache();
- // This method should be called from Core::Render()
+ // This method should be called from Core::PreRender()
/**
- * Renders the results of the previous "update" traversal.
- * @param[out] status contains the rendering flags.
- * @param[in] forceClear Force the Clear on the framebuffer even if nothing is rendered.
- * @param[in] uploadOnly Upload the resource only without rendering.
+ * This is called before rendering any scene in the next frame. This method should be preceded
+ * by a call up Update.
+ * Multi-threading note: this method should be called from a dedicated rendering thread.
+ * @pre The GL context must have been created, and made current.
+ * @param[out] status showing whether update is required to run.
+ * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
+ * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
*/
- void Render( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
+ void PreRender( Integration::RenderStatus& status, bool forceClear, bool uploadOnly );
-private:
+ // This method should be called from Core::RenderScene()
/**
- * Helper to process a single RenderInstruction.
- * @param[in] instruction A description of the rendering operation.
+ * Render a scene in the next frame. This method should be preceded by a call up PreRender.
+ * This method should be called twice. The first pass to render off-screen frame buffers if any,
+ * and the second pass to render the surface.
+ * Multi-threading note: this method should be called from a dedicated rendering thread.
+ * @pre The GL context must have been created, and made current.
+ * @param[in] scene The scene to be rendered.
+ * @param[in] renderToFbo True to render off-screen frame buffers only if any, and False to render the surface only.
*/
- void DoRender( RenderInstruction& instruction );
+ void RenderScene( Integration::Scene& scene, bool renderToFbo );
+
+ // This method should be called from Core::PostRender()
+
+ /**
+ * This is called after rendering all the scenes in the next frame. This method should be
+ * followed by a call up RenderScene.
+ * Multi-threading note: this method should be called from a dedicated rendering thread.
+ * @pre The GL context must have been created, and made current.
+ * @param[in] uploadOnly uploadOnly Upload the resource only without rendering.
+ */
+ void PostRender( bool uploadOnly );
+
+
+private:
private: