Added support for Multiple Render Targets, to Dali::FrameBuffer.
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / frame-buffer.h
index 456d3d7..8c513c3 100644 (file)
 
 namespace Dali
 {
+/**
+ * @addtogroup dali_core_rendering_effects
+ * @{
+ */
 
 namespace Internal DALI_INTERNAL
 {
@@ -56,19 +60,24 @@ public:
      */
     enum Mask
     {
-      NONE          = 0,                          ///< No attachments are created initially             @SINCE_1_1.45
-      DEPTH         = 1 << 0,                     ///< Depth buffer is created                          @SINCE_1_1.45
-      STENCIL       = 1 << 1,                     ///< Stencil buffer is created                        @SINCE_1_1.45
-      DEPTH_STENCIL = DEPTH | STENCIL,            ///< Depth and stencil buffer will be created         @SINCE_1_1.45
-      COLOR         = 1 << 2,                     ///< Color texture will be created                    @SINCE_1_4.0
-      COLOR_DEPTH   = COLOR | DEPTH,              ///< Color texture and depth buffer will be created   @SINCE_1_4.0
-      COLOR_STENCIL = COLOR | STENCIL,            ///< Color texture and stencil buffer will be created @SINCE_1_4.0
-      COLOR_DEPTH_STENCIL = COLOR_DEPTH | STENCIL ///< Color, depth and stencil buffer will be created  @SINCE_1_4.0
+      NONE          = 0,                          ///< No attachments are created initially.         @SINCE_1_1.45
+      DEPTH         = 1 << 0,                     ///< Depth buffer is created.                      @SINCE_1_1.45
+      STENCIL       = 1 << 1,                     ///< Stencil buffer is created.                    @SINCE_1_1.45
+      DEPTH_STENCIL = DEPTH | STENCIL,            ///< Depth and stencil buffer are created.         @SINCE_1_1.45
+      COLOR         = 1 << 2,                     ///< Color texture is created.                     @SINCE_1_4.0
+      COLOR_DEPTH   = COLOR | DEPTH,              ///< Color texture and depth buffer are created.   @SINCE_1_4.0
+      COLOR_STENCIL = COLOR | STENCIL,            ///< Color texture and stencil buffer are created. @SINCE_1_4.0
+      COLOR_DEPTH_STENCIL = COLOR_DEPTH | STENCIL ///< Color, depth and stencil buffer are created.  @SINCE_1_4.0
     };
   };
 
   /**
-   * @brief Creates a new FrameBuffer with only COLOR texture attached on it
+   * @brief Maximum number of color attachments supported.
+   */
+  static constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
+
+  /**
+   * @brief Creates a new FrameBuffer, which attaches only COLOR texture.
    *
    * @SINCE_1_4.0
    *
@@ -81,7 +90,7 @@ public:
   static FrameBuffer New( uint32_t width, uint32_t height );
 
   /**
-   * @brief Creates a new FrameBuffer with the specified attachments
+   * @brief Creates a new FrameBuffer with specific attachments.
    *
    * @SINCE_1_4.0
    *
@@ -145,6 +154,8 @@ public:
   /**
    * @brief Attach the base LOD of a 2D texture to the framebuffer for color rendering.
    * @note This causes a color attachment to be added.
+   * @note Repeated calls to this method add textures as subsequent color attachments.
+   * @note A maximum of 8 color attachments are supported.
    *
    * @SINCE_1_1.43
    * @param[in] texture The texture that will be used as output when rendering
@@ -156,6 +167,8 @@ public:
   /**
    * @brief Attach a texture to the framebuffer for color rendering.
    * @note This causes a color attachment to be added.
+   * @note Repeated calls to this method add textures as subsequent color attachments.
+   * @note A maximum of 8 color attachments are supported.
    *
    * @SINCE_1_1.43
    * @param[in] texture The texture that will be used as output when rendering
@@ -167,12 +180,22 @@ public:
   void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer );
 
   /**
-   * @brief Gets the color texture used as output in the FrameBuffer.
+   * @brief Gets the first color texture used as output in the FrameBuffer.
    *
    * @SINCE_1_1.43
    * @returns A handle to the texture used as color output, or an uninitialized handle
    */
-  Texture GetColorTexture();
+  Texture GetColorTexture() const;
+
+  /**
+   * @brief Gets the color texture at the given @a index used as output in the FrameBuffer.
+   * @note A maximum of 8 color attachments are supported. Passing an invalid index will return
+   * an uninitialized handle.
+   *
+   * @SINCE_1_1.43
+   * @returns A handle to the texture used as color output, or an uninitialized handle
+   */
+  Texture GetColorTexture(uint8_t index) const;
 
 public:
 
@@ -185,6 +208,9 @@ public:
   explicit DALI_INTERNAL FrameBuffer( Internal::FrameBuffer* pointer );
 };
 
+/**
+ * @}
+ */
 } //namespace Dali
 
 #endif // DALI_FRAMEBUFFER_H