[Tizen] Fix documentation of FrameBuffer
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-texture-frame-buffer.h
1 #ifndef DALI_INTERNAL_RENDER_TEXTURE_FRAME_BUFFER_H
2 #define DALI_INTERNAL_RENDER_TEXTURE_FRAME_BUFFER_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali/devel-api/rendering/frame-buffer-devel.h>
22 #include <dali/internal/render/renderers/render-frame-buffer.h>
23
24 namespace Dali
25 {
26 using Mask = Dali::FrameBuffer::Attachment::Mask;
27
28 namespace Internal
29 {
30 namespace Render
31 {
32 class Texture;
33
34 class TextureFrameBuffer : public FrameBuffer
35 {
36 public:
37
38   /**
39    * Constructor
40    * @param[in] width The width of the FrameBuffer
41    * @param[in] height The height of the FrameBuffer
42    * @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask)
43    */
44   TextureFrameBuffer( uint32_t width, uint32_t height, Mask attachments );
45
46   /**
47    * Destructor
48    */
49   virtual ~TextureFrameBuffer();
50
51   /**
52    * @copydoc Dali::Internal::Renderer::FrameBuffer::Initialize()
53    */
54   void Initialize( Context& context ) override;
55
56   /**
57    * @copydoc Dali::Internal::Renderer::FrameBuffer::Destroy()
58    */
59   void Destroy( Context& context ) override;
60
61   /**
62    * @copydoc Dali::Internal::Renderer::FrameBuffer::GlContextDestroyed()
63    */
64   void GlContextDestroyed() override;
65
66   /**
67    * @copydoc Dali::Internal::Renderer::FrameBuffer::Bind()
68    */
69   void Bind( Context& context ) override;
70
71   /**
72    * @copydoc Dali::Internal::Renderer::FrameBuffer::GetWidth()
73    */
74   uint32_t GetWidth() const override;
75
76   /**
77    * @copydoc Dali::Internal::Renderer::FrameBuffer::GetHeight()
78    */
79   uint32_t GetHeight() const override;
80
81   /**
82    * @copydoc Dali::Internal::Renderer::FrameBuffer::IsSurfaceBacked()
83    */
84   bool IsSurfaceBacked() override { return false; };
85
86   /**
87    * @brief Attaches a texture for the color rendering. This API is valid only for frame buffer with COLOR attachments.
88    * @param[in] context The GL context
89    * @param[in] texture The texture that will be used as output when rendering
90    * @param[in] mipmapLevel The mipmap of the texture to be attached
91    * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
92    * @note A maximum of Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS are supported.
93    */
94   void AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
95
96   /**
97    * @brief Attaches a texture for the depth rendering. This API is valid only for frame buffer with DEPTH attachments.
98    * @param[in] context The GL context
99    * @param[in] texture The texture that will be used as output when rendering
100    * @param[in] mipmapLevel The mipmap of the texture to be attached
101    */
102   void AttachDepthTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
103
104   /**
105    * @brief Attaches a texture for the depth/stencil rendering. This API is valid only for frame buffer with DEPTH_STENCIL attachments.
106    * @param[in] context The GL context
107    * @param[in] texture The texture that will be used as output when rendering
108    * @param[in] mipmapLevel The mipmap of the texture to be attached
109    */
110   void AttachDepthStencilTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
111
112   /**
113    * @brief Get the number of textures bound to this frame buffer as color attachments.
114    * @return The number of color attachments.
115    */
116   uint8_t GetColorAttachmentCount() const { return mColorAttachmentCount; }
117
118   /**
119    * @brief Get the id (OpenGL handle) of the texture bound to this frame buffer as color attachment @a index.
120    * @return The texture id.
121    */
122   GLuint GetTextureId(uint8_t index) { return mTextureId[index]; };
123
124 private:
125
126   GLuint mId;
127   GLuint mTextureId[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
128   GLuint mDepthBuffer;
129   GLuint mStencilBuffer;
130   uint32_t mWidth;
131   uint32_t mHeight;
132   uint8_t mColorAttachmentCount;
133 };
134
135
136 } // namespace Render
137
138 } // namespace Internal
139
140 } // namespace Dali
141
142
143 #endif // DALI_INTERNAL_RENDER_TEXTURE_FRAME_BUFFER_H