1 #ifndef DALI_GRAPHICS_VULKAN_IMAGE_H
2 #define DALI_GRAPHICS_VULKAN_IMAGE_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/graphics/vulkan/vulkan-types.h>
31 enum class ResourceOwnershipType
37 class Image : public Resource
41 * Creates new VkImage with given specification, it doesn't
46 Image(Graphics& graphics, const vk::ImageCreateInfo& createInfo);
49 * Constructor creates wrapper on the VkImage coming from external
50 * source. It doesn't take over ownership so it's still owner's
51 * responsibility to destroy it and maintain the usage.
54 * @param externalImage
56 Image(Graphics& graphics, vk::Image externalImage);
61 virtual ~Image() = default;
64 * Creates UNMANAGED VkImageView from the current image.
65 * Usage requires external lifecycle management and synchronization
66 * Memory MUST be bound for this function to work!
70 vk::ImageView CreateUnmanagedView(const vk::ImageViewCreateInfo& info);
73 * Creates MANAGED ImageView from the current image
74 * Memory MUST be bound for this function to work!
78 UniqueImageView CreateView(const vk::ImageViewCreateInfo& info);
81 * Returns underlying Vulkan object
84 vk::Image GetImage() const
94 vk::ImageLayout mLayout;
96 ResourceOwnershipType mOwnershipType;
101 * todo: move it to its own file
103 class ImageView : public Resource
106 ImageView(Graphics& graphics, Image& image);
107 ImageView(Graphics& graphics, Image& image, const VkImageViewCreateInfo& createInfo);
109 virtual ~ImageView() override;
111 const vk::ImageView& GetImageView() const
116 Image& GetImage() const
118 return mImageRef.GetResource();
123 ResourceRef<Image> mImageRef;
125 vk::ImageView mImageView;
128 } // namespace Vulkan
130 } // namespace Graphics
134 #endif // DALI_GRAPHICS_VULKAN_IMAGE_H