X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-manager.h;h=54ed12d068ed06637877a479dba3206dce7daafd;hb=a5c69f680da5cb00a9d9973584057f4ef08d1f8e;hp=9b899591341950f96bd90ebf821ef3fed404a288;hpb=70d8a1699a38f4f72b6d57f8af6da6651d6902ec;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 9b89959..54ed12d 100644 --- a/dali/internal/render/common/render-manager.h +++ b/dali/internal/render/common/render-manager.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,30 +19,25 @@ */ // INTERNAL INCLUDES -#include +#include #include #include -#include -#include #include +#include +#include namespace Dali { - namespace Integration { -class GlAbstraction; -class GlSyncAbstraction; -class GlContextHelperAbstraction; class RenderStatus; class Scene; -} +} // namespace Integration struct Vector4; namespace Internal { -class Context; class ProgramCache; class ShaderSaver; @@ -54,7 +49,7 @@ struct Sampler; class RenderTracker; class Geometry; class Texture; -} +} // namespace Render namespace SceneGraph { @@ -62,7 +57,6 @@ class RenderQueue; class RenderInstruction; class RenderInstructionContainer; class Shader; -class PropertyBufferDataProvider; class Scene; /** @@ -72,20 +66,16 @@ class Scene; class RenderManager { 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] glContextHelperAbstraction The GL context helper abstraction for accessing GL context. + * @param[in] graphicsController The graphics controller for a given rendering backend * @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 ); + static RenderManager* New(Graphics::Controller& graphicsController, + Integration::DepthBufferAvailable depthBufferAvailable, + Integration::StencilBufferAvailable stencilBufferAvailable, + Integration::PartialUpdateAvailable partialUpdateAvailable); /** * Non-virtual destructor; not intended as a base class @@ -99,71 +89,55 @@ public: RenderQueue& GetRenderQueue(); /** - * @copydoc Dali::Integration::Core::ContextCreated() - */ - void ContextCreated(); - - /** - * @copydoc Dali::Integration::Core::ContextToBeDestroyed() - */ - void ContextDestroyed(); - - /** * Set the upstream interface for compiled shader binaries to be sent back to for eventual * caching and saving. * @param[in] upstream The abstract interface to send any received ShaderDatas onwards to.. * @note This should be called during core initialisation if shader binaries are to be used. */ - void SetShaderSaver( ShaderSaver& upstream ); + void SetShaderSaver(ShaderSaver& upstream); - // The following methods should be called via RenderQueue messages + // The foltlowing methods should be called via RenderQueue messages /* * Set the frame time delta (time elapsed since the last frame. * @param[in] deltaTime the delta time */ - void SetFrameDeltaTime( float deltaTime ); - - /** - * Returns the rectangle for the default surface (probably the application window). - * @return Rectangle for the surface. - */ - void SetDefaultSurfaceRect( const Rect& rect ); + void SetFrameDeltaTime(float deltaTime); /** * Add a Renderer to the render manager. * @param[in] renderer The renderer to add. * @post renderer is owned by RenderManager */ - void AddRenderer( OwnerPointer< Render::Renderer >& renderer ); + void AddRenderer(OwnerPointer& renderer); /** * Remove a Renderer from the render manager. * @param[in] renderer The renderer to remove. * @post renderer is destroyed. */ - void RemoveRenderer( Render::Renderer* renderer ); + void RemoveRenderer(Render::Renderer* renderer); /** * Add a sampler to the render manager. * @param[in] sampler The sampler to add. * @post sampler is owned by RenderManager */ - void AddSampler( OwnerPointer< Render::Sampler >& sampler ); + void AddSampler(OwnerPointer& sampler); /** * Remove a sampler from the render manager. * @param[in] sampler The sampler to remove. * @post sampler is destroyed. */ - void RemoveSampler( Render::Sampler* sampler ); + void RemoveSampler(Render::Sampler* sampler); /** * Set minification and magnification filter modes for a sampler * @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, uint32_t minFilterMode, uint32_t magFilterMode ); + void SetFilterMode(Render::Sampler* sampler, uint32_t minFilterMode, uint32_t magFilterMode); /** * Set wrapping mode for a sampler @@ -171,91 +145,91 @@ public: * @param[in] uWrapMode Wrap mode in the x direction * @param[in] vWrapMode Wrap mode in the y direction */ - void SetWrapMode( Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode ); + void SetWrapMode(Render::Sampler* sampler, uint32_t rWrapMode, uint32_t sWrapMode, uint32_t tWrapMode); /** * Add a property buffer to the render manager. - * @param[in] propertyBuffer The property buffer to add. + * @param[in] vertexBuffer The property buffer to add. * @post propertBuffer is owned by RenderManager */ - void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer ); + void AddVertexBuffer(OwnerPointer& vertexBuffer); /** * Remove a property buffer from the render manager. - * @param[in] propertyBuffer The property buffer to remove. - * @post propertyBuffer is destroyed. + * @param[in] vertexBuffer The property buffer to remove. + * @post vertexBuffer is destroyed. */ - void RemovePropertyBuffer( Render::PropertyBuffer* propertyBuffer ); + void RemoveVertexBuffer(Render::VertexBuffer* vertexBuffer); /** * Add a geometry to the render manager. * @param[in] geometry The geometry to add. * @post geometry is owned by RenderManager */ - void AddGeometry( OwnerPointer< Render::Geometry >& geometry ); + void AddGeometry(OwnerPointer& geometry); /** * Remove a geometry from the render manager. * @param[in] geometry The geometry to remove. * @post geometry is destroyed. */ - void RemoveGeometry( Render::Geometry* geometry ); + void RemoveGeometry(Render::Geometry* geometry); /** * Adds a property buffer to a geometry from the render manager. * @param[in] geometry The geometry - * @param[in] propertyBuffer The property buffer to remove. + * @param[in] vertexBuffer The property buffer to remove. */ - void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + void AttachVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer); /** * Remove a property buffer from a Render::Geometry from the render manager. * @param[in] geometry The geometry - * @param[in] propertyBuffer The property buffer to remove. + * @param[in] vertexBuffer The property buffer to remove. * @post property buffer is destroyed. */ - void RemoveVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer ); + void RemoveVertexBuffer(Render::Geometry* geometry, Render::VertexBuffer* vertexBuffer); /** * Sets the format of an existing property buffer - * @param[in] propertyBuffer The property buffer. + * @param[in] vertexBuffer The property buffer. * @param[in] format The new format of the buffer */ - void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format ); + void SetVertexBufferFormat(Render::VertexBuffer* vertexBuffer, OwnerPointer& format); /** * Sets the data of an existing property buffer - * @param[in] propertyBuffer The property buffer. + * @param[in] vertexBuffer The property buffer. * @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, uint32_t size ); + void SetVertexBufferData(Render::VertexBuffer* vertexBuffer, OwnerPointer>& 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, uint32_t geometryType ); + void SetGeometryType(Render::Geometry* geometry, uint32_t geometryType); /** * Adds a texture to the render manager * @param[in] texture The texture to add */ - void AddTexture( OwnerPointer< Render::Texture >& texture ); + void AddTexture(OwnerPointer& texture); /** * Removes a texture from the render manager * @param[in] texture The texture to remove */ - void RemoveTexture( Render::Texture* texture ); + void RemoveTexture(Render::Texture* texture); /** * Uploads data to an existing texture @@ -263,52 +237,68 @@ public: * @param[in] pixelData The pixel data object * @param[in] params The parameters for the upload */ - void UploadTexture( Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params ); + void UploadTexture(Render::Texture* texture, PixelDataPtr pixelData, const Texture::UploadParams& params); /** * Generates mipmaps for a given texture * @param[in] texture The texture */ - void GenerateMipmaps( Render::Texture* texture ); + void GenerateMipmaps(Render::Texture* texture); /** * Adds a framebuffer to the render manager * @param[in] frameBuffer The framebuffer to add */ - void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer ); + void AddFrameBuffer(OwnerPointer& frameBuffer); /** * Removes a framebuffer from the render manager * @param[in] frameBuffer The framebuffer to remove */ - void RemoveFrameBuffer( Render::FrameBuffer* frameBuffer ); + void RemoveFrameBuffer(Render::FrameBuffer* frameBuffer); /** - * Attach a texture as color output to an existing FrameBuffer + * Attaches a texture as color output to the existing frame buffer * @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 * @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, uint32_t mipmapLevel, uint32_t layer ); + void AttachColorTextureToFrameBuffer(Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer); + + /** + * Attaches a texture as depth output to the existing frame buffer + * @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); + + /** + * Attaches a texture as depth/stencil output to the existing frame buffer + * @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 ); + void InitializeScene(SceneGraph::Scene* scene); /** * Uninitializes a Scene to the render manager * @param[in] scene The Scene to uninitialize */ - void UninitializeScene( SceneGraph::Scene* scene ); + 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 ); + void SurfaceReplaced(SceneGraph::Scene* scene); /** * Adds a render tracker to the RenderManager. RenderManager takes ownership of the @@ -316,19 +306,13 @@ public: * object, usually an offscreen render task. * @param[in] renderTracker The render tracker */ - void AddRenderTracker( Render::RenderTracker* renderTracker ); + void AddRenderTracker(Render::RenderTracker* renderTracker); /** * Removes a render tracker from the RenderManager. * @param[in] renderTracker The render tracker to remove. */ - void RemoveRenderTracker( Render::RenderTracker* renderTracker ); - - /** - * returns the Program controller for sending program messages - * @return the ProgramController - */ - ProgramCache* GetProgramCache(); + void RemoveRenderTracker(Render::RenderTracker* renderTracker); // This method should be called from Core::PreRender() @@ -336,12 +320,24 @@ public: * 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. + * @pre The graphics implementation must be initialized * @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 PreRender( Integration::RenderStatus& status, bool forceClear, bool uploadOnly ); + void PreRender(Integration::RenderStatus& status, bool forceClear, bool uploadOnly); + + // This method should be called from Core::PreRender() + + /** + * 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 graphics implementation must be initialized + * @param[in] scene The scene to be rendered. + * @param[out] damagedRects The list of damaged rects for the current render pass. + */ + void PreRender(Integration::RenderStatus& status, Integration::Scene& scene, std::vector>& damagedRects); // This method should be called from Core::RenderScene() @@ -350,11 +346,25 @@ public: * 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. + * @pre The graphics implementation must be initialized + * @param[out] status contains the rendering flags. + * @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 RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo); + + /** + * 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 graphics implementation must be initialized + * @param[out] status contains the rendering flags. * @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. + * @param[in] clippingRect The clipping rect for the rendered scene. */ - void RenderScene( Integration::Scene& scene, bool renderToFbo ); + void RenderScene(Integration::RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect& clippingRect); // This method should be called from Core::PostRender() @@ -362,32 +372,26 @@ public: * 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. + * @pre The graphics implementation must be initialized * @param[in] uploadOnly uploadOnly Upload the resource only without rendering. */ - void PostRender( bool uploadOnly ); - - -private: + void PostRender(bool uploadOnly); private: - /** * Construct a new RenderManager. */ RenderManager(); // Undefined - RenderManager( const RenderManager& ); + RenderManager(const RenderManager&); // Undefined - RenderManager& operator=( const RenderManager& rhs ); + RenderManager& operator=(const RenderManager& rhs); private: - struct Impl; Impl* mImpl; - }; } // namespace SceneGraph