X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.h;h=9b899591341950f96bd90ebf821ef3fed404a288;hb=79881246746f65474b24ea4fe14151ccef8df3f4;hp=5e48692ddee8b5057d5da688cd737d799197dd2e;hpb=145a9d83ce4debdb5876fa65a246eb65a46a4c01;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-manager.h b/dali/internal/render/common/render-manager.h index 5e48692..9b89959 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__ +#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H +#define DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H /* - * Copyright (c) 2017 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. @@ -33,7 +33,9 @@ namespace Integration { class GlAbstraction; class GlSyncAbstraction; +class GlContextHelperAbstraction; class RenderStatus; +class Scene; } struct Vector4; @@ -61,6 +63,7 @@ class RenderInstruction; class RenderInstructionContainer; class Shader; class PropertyBufferDataProvider; +class Scene; /** * RenderManager is responsible for rendering the result of the previous "update", which @@ -72,13 +75,15 @@ public: /** * Construct a new RenderManager. - * @param[in] glAbstraction The GL abstraction used for rendering. - * @param[in] glSyncAbstraction The GL sync abstraction used fence sync creation/deletion. - * @param[in] depthBufferAvailable Whether the depth buffer is available - * @param[in] stencilBufferAvailable Whether the stencil buffer is available + * @param[in] glAbstraction The GL abstraction used for rendering. + * @param[in] glSyncAbstraction The GL sync abstraction used fence sync creation/deletion. + * @param[in] glContextHelperAbstraction The GL context helper abstraction for accessing GL context. + * @param[in] depthBufferAvailable Whether the depth buffer is available + * @param[in] stencilBufferAvailable Whether the stencil buffer is available */ static RenderManager* New( Integration::GlAbstraction& glAbstraction, Integration::GlSyncAbstraction& glSyncAbstraction, + Integration::GlContextHelperAbstraction& glContextHelperAbstraction, Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable ); @@ -111,20 +116,8 @@ public: */ 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 @@ -170,7 +163,7 @@ public: * @param[in] minFilterMode Filter mode to use when the texture is minificated * @param[in] magFilterMode Filter mode to use when the texture is magnified */ - void SetFilterMode( Render::Sampler* sampler, unsigned int minFilterMode, unsigned int magFilterMode ); + void SetFilterMode( Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode ); /** * Set wrapping mode for a sampler @@ -178,7 +171,7 @@ public: * @param[in] uWrapMode Wrap mode in the x direction * @param[in] vWrapMode Wrap mode in the y direction */ - void SetWrapMode( Render::Sampler* sampler, unsigned int rWrapMode, unsigned int sWrapMode, unsigned int tWrapMode ); + void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode ); /** * Add a property buffer to the render manager. @@ -236,21 +229,21 @@ public: * @param[in] data The new data of the buffer * @param[in] size The new size of the buffer */ - void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, size_t size ); + void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector >& data, uint32_t size ); /** * Sets the data for the index buffer of an existing geometry * @param[in] geometry The geometry * @param[in] data A vector containing the indices */ - void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& data ); + void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector& data ); /** * Set the geometry type of an existing render geometry * @param[in] geometry The render geometry * @param[in] geometryType The new geometry type */ - void SetGeometryType( Render::Geometry* geometry, unsigned int geometryType ); + void SetGeometryType( Render::Geometry* geometry, uint32_t geometryType ); /** * Adds a texture to the render manager @@ -282,7 +275,7 @@ public: * Adds a framebuffer to the render manager * @param[in] frameBuffer The framebuffer to add */ - void AddFrameBuffer( Render::FrameBuffer* frameBuffer ); + void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer ); /** * Removes a framebuffer from the render manager @@ -297,7 +290,25 @@ public: * @param[in] mipmapLevel The mipmap of the texture to be attached * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures */ - void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer ); + void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer ); + + /** + * 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 @@ -319,21 +330,45 @@ public: */ 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. + * 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 ); + 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: @@ -361,4 +396,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__ +#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H