[dali_2.3.34] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / devel-api / rendering / frame-buffer-devel.h
1 #ifndef DALI_FRAME_BUFFER_DEVEL_H
2 #define DALI_FRAME_BUFFER_DEVEL_H
3
4 /*
5  * Copyright (c) 2022 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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/rendering/frame-buffer.h>
23
24 namespace Dali
25 {
26 namespace DevelFrameBuffer
27 {
28 /**
29  * @brief Maximum number of color attachments supported.
30  */
31 constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
32
33 /**
34  * @brief Attaches the base LOD of a depth texture to the frame buffer.
35  * @note This causes a depth attachment to be added.
36  *
37  * @param[in] frameBuffer A handle to the FrameBuffer
38  * @param[in] texture The texture that will be used as output when rendering
39  * @note The size of the texture has to be same as that of the frame buffer.
40  * Otherwise, it won't be attached.
41  */
42 DALI_CORE_API void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture);
43
44 /**
45  * @brief Attaches a depth texture to the frame buffer.
46  * @note This causes a depth attachment to be added.
47  *
48  * @param[in] frameBuffer A handle to the FrameBuffer
49  * @param[in] texture The texture that will be used as output when rendering
50  * @param[in] mipmapLevel The mipmap of the texture to be attached
51  * @note The size of the mipmapped texture has to be same as that of the frame buffer.
52  * Otherwise, it won't be attached.
53  */
54 DALI_CORE_API void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel);
55
56 /**
57  * @brief Attaches the base LOD of a stencil texture to the frame buffer.
58  * @note This causes a stencil attachment to be added.
59  *
60  * @param[in] frameBuffer A handle to the FrameBuffer
61  * @param[in] texture The texture that will be used as output when rendering
62  * @note The size of the texture has to be same as that of the frame buffer.
63  * Otherwise, it won't be attached.
64  */
65 DALI_CORE_API void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture);
66
67 /**
68  * @brief Attaches a depth/stencil texture to the frame buffer.
69  * @note This causes a depth/stencil attachment to be added.
70  *
71  * @param[in] frameBuffer A handle to the FrameBuffer
72  * @param[in] texture The texture that will be used as output when rendering
73  * @param[in] mipmapLevel The mipmap of the texture to be attached
74  * @note The size of the mipmapped texture has to be same as that of the frame buffer.
75  * Otherwise, it won't be attached.
76  */
77 DALI_CORE_API void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel);
78
79 /**
80  * @brief Sets the level of multisampling in the frame buffer.
81  * @note This API must be called before the frame buffer is attached to render task. (Since multi sample level is immutable)
82  * Otherwise, no effects.
83  *
84  * @param[in] frameBuffer The FrameBuffer handle
85  * @param[in] multiSamplingLevel The level of samples
86  */
87 DALI_CORE_API void SetMultiSamplingLevel(FrameBuffer frameBuffer, uint8_t multiSamplingLevel);
88
89 /**
90  * @brief Gets the color texture at the given @a index used as output in the frame buffer.
91  *
92  * @param[in] frameBuffer A handle to the FrameBuffer
93  * @param[in] index The index required
94  *
95  * @return A handle to the texture used as color output, or an uninitialized handle
96  *
97  * @note A maximum of 8 color attachments are supported. Passing an invalid index will return
98  * an uninitialized handle.
99  */
100 DALI_CORE_API Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index);
101
102 /**
103  * @brief Gets the depth texture used as output in the frame buffer.
104  *
105  * @param[in] frameBuffer The FrameBuffer handle
106  *
107  * @return A handle of the texture used as depth output, or an uninitialized handle
108  */
109 DALI_CORE_API Texture GetDepthTexture(FrameBuffer frameBuffer);
110
111 /**
112  * @brief Gets the depth/stencil texture used as output in the frame buffer.
113  *
114  * @param[in] frameBuffer The FrameBuffer handle
115  *
116  * @return A handle of the texture used as depth/stencil output, or an uninitialized handle
117  */
118 DALI_CORE_API Texture GetDepthStencilTexture(FrameBuffer frameBuffer);
119
120 } // namespace DevelFrameBuffer
121
122 } // namespace Dali
123
124 #endif // DALI_FRAME_BUFFER_DEVEL_H