fe0d07248f234f18a7e5e997038c453071bf8f4d
[platform/core/uifw/dali-core.git] / dali / devel-api / rendering / frame-buffer-devel.cpp
1 /*
2  * Copyright (c) 2020 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 Texture GetColorTexture(const FrameBuffer frameBuffer, uint8_t index)
57 {
58   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetColorTexture(index);
59   return Dali::Texture(texturePtr);
60 }
61
62 Texture GetDepthTexture(FrameBuffer frameBuffer)
63 {
64   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthTexture();
65   return Dali::Texture(texturePtr);
66 }
67
68 Texture GetDepthStencilTexture(FrameBuffer frameBuffer)
69 {
70   Internal::Texture* texturePtr = GetImplementation(frameBuffer).GetDepthStencilTexture();
71   return Dali::Texture(texturePtr);
72 }
73
74 } // namespace DevelFrameBuffer
75
76 } // namespace Dali