c7aba760cd7412a6685085427932313bc7362572
[platform/core/uifw/dali-core.git] / dali / graphics / vulkan / vulkan-image-view.h
1 #ifndef DALI_GRAPHICS_VULKAN_IMAGE_VIEW
2 #define DALI_GRAPHICS_VULKAN_IMAGE_VIEW
3
4 /*
5  * Copyright (c) 2018 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 #include <dali/graphics/vulkan/vulkan-types.h>
22
23 namespace Dali
24 {
25 namespace Graphics
26 {
27 namespace Vulkan
28 {
29
30 /*
31  * ImageView
32  */
33 class ImageView : public VkManaged
34 {
35 public:
36
37   /**
38    * Creates ImageView according to the given spec
39    * @param graphics
40    * @param image
41    * @param info
42    * @return
43    */
44   static RefCountedImageView New( Graphics& graphics, const RefCountedImage& image, const vk::ImageViewCreateInfo& createInfo);
45
46
47   ~ImageView() override;
48
49   /**
50    *
51    * @return
52    */
53   vk::ImageView GetVkHandle() const;
54
55   /**
56    * Returns bound ImageRef
57    * @return
58    */
59   RefCountedImage GetImage() const;
60
61   /**
62    *
63    * @return
64    */
65   uint32_t GetLayerCount() const;
66
67   /**
68    *
69    * @return
70    */
71   uint32_t GetMipLevelCount() const;
72
73   /**
74    *
75    * @return
76    */
77   vk::ImageAspectFlags GetImageAspectMask() const;
78
79   const ImageView& ConstRef();
80
81   ImageView& Ref();
82
83   operator vk::ImageView*();
84
85   bool OnDestroy() override;
86 //TODO: Use the graphics class to manage lifetime.
87
88 private:
89   ImageView( Graphics& graphics,
90              RefCountedImage image,
91              vk::ImageViewCreateInfo createInfo );
92
93 private:
94   Graphics*                      mGraphics;
95   RefCountedImage                mImage;
96   vk::ImageViewCreateInfo        mCreateInfo;
97   vk::ImageView                  mImageView;
98 };
99
100 } //namespace Vulkan
101 } //namespace Graphics
102 } //namespace Dali
103
104 #endif //DALI_GRAPHICS_VULKAN_IMAGE_VIEW