Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-manager.h
index e27d508..fd3e35c 100644 (file)
@@ -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) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -20,9 +20,8 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/math/rect.h>
+#include <dali/integration-api/core-enumerations.h>
 #include <dali/internal/common/shader-saver.h>
-#include <dali/internal/update/resources/resource-manager-declarations.h>
-#include <dali/internal/render/common/texture-uploaded-dispatcher.h>
 #include <dali/internal/render/gl-resources/gpu-buffer.h>
 #include <dali/internal/render/renderers/render-property-buffer.h>
 #include <dali/internal/event/rendering/texture-impl.h>
@@ -34,6 +33,7 @@ namespace Integration
 {
 class GlAbstraction;
 class GlSyncAbstraction;
+class GlContextHelperAbstraction;
 class RenderStatus;
 }
 
@@ -52,13 +52,12 @@ class Renderer;
 struct Sampler;
 class RenderTracker;
 class Geometry;
-class NewTexture;
+class Texture;
 }
 
 namespace SceneGraph
 {
 class RenderQueue;
-class TextureCache;
 class RenderInstruction;
 class RenderInstructionContainer;
 class Shader;
@@ -68,19 +67,23 @@ class PropertyBufferDataProvider;
  * RenderManager is responsible for rendering the result of the previous "update", which
  * is provided in a RenderCommand during UpdateManager::Update().
  */
-class RenderManager : public TextureUploadedDispatcher
+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[out] resourcePostProcessQueue A queue for sending rendered texture ids to the update-thread.*
+   * @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,
-                             LockedResourceQueue& resourcePostProcessQueue );
+                             Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
+                             Integration::DepthBufferAvailable depthBufferAvailable,
+                             Integration::StencilBufferAvailable stencilBufferAvailable );
 
   /**
    * Non-virtual destructor; not intended as a base class
@@ -94,13 +97,6 @@ public:
   RenderQueue& GetRenderQueue();
 
   /**
-   * Retrieve the texture cache. Messages should only be sent to this from the update thread,
-   * accessor methods should only be used from the render thread.
-   * @return The texture cache
-   */
-  TextureCache& GetTextureCache();
-
-  /**
    * @copydoc Dali::Integration::Core::ContextCreated()
    */
   void ContextCreated();
@@ -111,12 +107,6 @@ public:
   void ContextDestroyed();
 
   /**
-   * Dispatch requests onto the postProcessResourcesQueue
-   * @param[in] resource The Id of the resource to dispatch
-   */
-  virtual void DispatchTextureUploaded( ResourceId resource );
-
-  /**
    * 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..
@@ -155,7 +145,7 @@ public:
    * @param[in] renderer The renderer to add.
    * @post renderer is owned by RenderManager
    */
-  void AddRenderer( Render::Renderer* renderer );
+  void AddRenderer( OwnerPointer< Render::Renderer >& renderer );
 
   /**
    * Remove a Renderer from the render manager.
@@ -169,7 +159,7 @@ public:
    * @param[in] sampler The sampler to add.
    * @post sampler is owned by RenderManager
    */
-  void AddSampler( Render::Sampler* sampler );
+  void AddSampler( OwnerPointer< Render::Sampler >& sampler );
 
   /**
    * Remove a sampler from the render manager.
@@ -183,7 +173,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
@@ -191,14 +181,14 @@ 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.
    * @param[in] propertyBuffer The property buffer to add.
    * @post propertBuffer is owned by RenderManager
    */
-  void AddPropertyBuffer( Render::PropertyBuffer* propertyBuffer );
+  void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertyBuffer );
 
   /**
    * Remove a property buffer from the render manager.
@@ -212,7 +202,7 @@ public:
    * @param[in] geometry The geometry to add.
    * @post geometry is owned by RenderManager
    */
-  void AddGeometry( Render::Geometry* geometry );
+  void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
 
   /**
    * Remove a geometry from the render manager.
@@ -226,7 +216,7 @@ public:
    * @param[in] geometry The geometry
    * @param[in] propertyBuffer The property buffer to remove.
    */
-  void AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+  void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
 
   /**
    * Remove a property buffer from a Render::Geometry from the render manager.
@@ -241,7 +231,7 @@ public:
    * @param[in] propertyBuffer The property buffer.
    * @param[in] format The new format of the buffer
    */
-  void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
+  void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
 
   /**
    * Sets the data of an existing property buffer
@@ -249,33 +239,33 @@ public:
    * @param[in] data The new data of the buffer
    * @param[in] size The new size of the buffer
    */
-  void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size );
+  void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<uint8_t> >& 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<unsigned short>& data );
+  void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<uint16_t>& 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
    * @param[in] texture The texture to add
    */
-  void AddTexture( Render::NewTexture* texture );
+  void AddTexture( OwnerPointer< Render::Texture >& texture );
 
   /**
    * Removes a texture from the render manager
    * @param[in] texture The texture to remove
    */
-  void RemoveTexture( Render::NewTexture* texture );
+  void RemoveTexture( Render::Texture* texture );
 
   /**
    * Uploads data to an existing texture
@@ -283,19 +273,19 @@ public:
    * @param[in] pixelData The pixel data object
    * @param[in] params The parameters for the upload
    */
-  void UploadTexture( Render::NewTexture* texture, PixelDataPtr pixelData, const NewTexture::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::NewTexture* texture );
+  void GenerateMipmaps( Render::Texture* texture );
 
   /**
    * 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
@@ -310,7 +300,7 @@ 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::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer );
+  void AttachColorTextureToFrameBuffer( Render::FrameBuffer* frameBuffer, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
 
   /**
    * Adds a render tracker to the RenderManager. RenderManager takes ownership of the
@@ -327,12 +317,6 @@ public:
   void RemoveRenderTracker( Render::RenderTracker* renderTracker );
 
   /**
-   * Set the default shader that is to be used in absence of custom shader
-   * @param[in] shader that is the default one
-   */
-  void SetDefaultShader( Shader* shader );
-
-  /**
    * returns the Program controller for sending program messages
    * @return the ProgramController
    */
@@ -342,19 +326,18 @@ public:
 
   /**
    * Renders the results of the previous "update" traversal.
-   * @param[out] status contains the flag that indicates if render instructions exist
-   * @return true if a further update is required
+   * @param[out] status contains the rendering flags.
+   * @param[in] forceClear force the Clear on the framebuffer even if nothing is rendered.
    */
-  bool Render( Integration::RenderStatus& status );
+  void Render( Integration::RenderStatus& status, bool forceClear );
 
 private:
 
   /**
    * Helper to process a single RenderInstruction.
    * @param[in] instruction A description of the rendering operation.
-   * @param[in] defaultShader default shader to use.
    */
-  void DoRender( RenderInstruction& instruction, Shader& defaultShader );
+  void DoRender( RenderInstruction& instruction );
 
 private:
 
@@ -382,4 +365,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_MANAGER_H