[Tizen] Support to get raw pixel informations of framebuffer for old driver device
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles-graphics-framebuffer.h
index 784d3bd..18e31f9 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_GRAPHICS_GLES_FRAMEBUFFER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -37,44 +37,72 @@ public:
    * @param[in] createInfo Valid createInfo structure
    * @param[in] controller Reference to the controller
    */
-  Framebuffer(const Graphics::FramebufferCreateInfo& createInfo, Graphics::EglGraphicsController& controller)
-  : FramebufferResource(createInfo, controller)
-  {
-  }
+  Framebuffer(const Graphics::FramebufferCreateInfo& createInfo, Graphics::EglGraphicsController& controller);
 
   /**
    * @brief Destructor
    */
-  ~Framebuffer() override = default;
+  ~Framebuffer() override;
 
   /**
    * @brief Called when GL resources are destroyed
    */
-  void DestroyResource() override
-  {
-    // TODO: Implement destroying the resource
-  }
+  void DestroyResource() override;
 
   /**
    * @brief Called when initializing the resource
    *
    * @return True on success
    */
-  bool InitializeResource() override
-  {
-    // TODO: Implement initializing resource
-    return {};
-  }
+  bool InitializeResource() override;
 
   /**
    * @brief Called when UniquePtr<> on client-side dies
    */
-  void DiscardResource() override
+  void DiscardResource() override;
+
+  /**
+   * Used to bind the framebuffer, e.g. when offscreen changes
+   */
+  void Bind() const;
+
+  [[nodiscard]] uint32_t GetGlFramebufferId() const;
+
+  [[nodiscard]] uint32_t GetGlDepthBufferId() const;
+
+  [[nodiscard]] uint32_t GetGlStencilBufferId() const;
+
+  void CaptureRenderingResult(CallbackBase* capturedCallback, uint8_t* capturedBuffer);
+
+  void DrawRenderedBuffer();
+
+  bool CaptureRequested() const
   {
-    // TODO: Implement moving to the discard queue
+    return mCaptureRenderedResult;
   }
+
+private:
+  /**
+   * Attach a texture to the specified attachment point
+   * @param[in] texture The texture to bind
+   * @param[in] attachmentId The attachment point to bind it to
+   * @param[in] layerId The texture layer (e.g. for cubemap)
+   * @param[in] levelId The texture mipmap level
+   */
+  void AttachTexture(const Graphics::Texture* texture, uint32_t attachmentId, uint32_t layerId, uint32_t levelId);
+
+private:
+  uint32_t mFramebufferId{0u};
+  uint32_t mDepthBufferId{0u};
+  uint32_t mStencilBufferId{0u};
+  uint32_t mMultisamples{1u};
+  bool     mInitialized{false};
+
+  uint8_t*            mCapturedBuffer{nullptr};   ///< not owned
+  Dali::CallbackBase* mCapturedCallback{nullptr}; ///< not owned
+  bool                mCaptureRenderedResult{false};
 };
 
 } // namespace Dali::Graphics::GLES
 
-#endif
\ No newline at end of file
+#endif