Add Post Constraint that works after transform
[platform/core/uifw/dali-core.git] / dali / devel-api / rendering / frame-buffer-devel.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // HEADER
19 #include <dali/devel-api/rendering/frame-buffer-devel.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/rendering/frame-buffer-impl.h> // Dali::Internal::FrameBuffer
23
24 namespace Dali
25 {
26 namespace DevelFrameBuffer
27 {
28 void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture)
29 {
30   AttachDepthTexture(frameBuffer, texture, 0u);
31 }
32
33 void AttachDepthTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel)
34 {
35   if(texture)
36   {
37     Internal::TexturePtr texturePtr(&GetImplementation(texture));
38     GetImplementation(frameBuffer).AttachDepthTexture(texturePtr, mipmapLevel);
39   }
40 }
41
42 void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture)
43 {
44   AttachDepthStencilTexture(frameBuffer, texture, 0u);
45 }
46
47 void AttachDepthStencilTexture(FrameBuffer frameBuffer, Texture& texture, uint32_t mipmapLevel)
48 {
49   if(texture)
50   {
51     Internal::TexturePtr texturePtr(&GetImplementation(texture));
52     GetImplementation(frameBuffer).AttachDepthStencilTexture(texturePtr, mipmapLevel);
53   }
54 }
55
56 void SetMultiSamplingLevel(FrameBuffer frameBuffer, uint8_t multiSamplingLevel)
57 {
58   GetImplementation(frameBuffer).SetMultiSamplingLevel(multiSamplingLevel);
59 }
60
61 Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index)
62 {
63   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetColorTexture(index);
64   return Dali::Texture(texturePtr);
65 }
66
67 Texture GetDepthTexture(FrameBuffer frameBuffer)
68 {
69   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthTexture();
70   return Dali::Texture(texturePtr);
71 }
72
73 Texture GetDepthStencilTexture(FrameBuffer frameBuffer)
74 {
75   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthStencilTexture();
76   return Dali::Texture(texturePtr);
77 }
78
79 } // namespace DevelFrameBuffer
80
81 } // namespace Dali