NAP
imagedata.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7  // External Includes
8 #include <vulkan/vulkan_core.h>
9 #include <utility/dllexport.h>
10 #include <nap/numeric.h>
11 #include <assert.h>
12 #include <vector>
13 
14 // Local Includes
15 #include "vk_mem_alloc.h"
16 
17 namespace nap
18 {
23  struct NAPAPI ImageData
24  {
25  // Default Constructor
26  ImageData() = default;
27 
28  // Constructor
29  ImageData(uint viewCount) :
30  mSubViews(viewCount, VK_NULL_HANDLE) { }
31 
35  VkImageView getView() const { return mView; }
36 
40  VkImageView getSubView(uint index) const { assert(index < mSubViews.size()); return mSubViews[index]; }
41 
45  uint getSubViewCount() const { return mSubViews.size(); }
46 
50  VkImage getImage() const { return mImage; }
51 
55  VkImageLayout getLayout() const { return mCurrentLayout; }
56 
60  void release();
61 
62  VkImage mImage = VK_NULL_HANDLE;
63  VkImageView mView = VK_NULL_HANDLE;
64  VmaAllocation mAllocation = VK_NULL_HANDLE;
65  VmaAllocationInfo mAllocationInfo;
66  VkImageLayout mCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED;
67  std::vector<VkImageView> mSubViews;
68  };
69 }
nap::uint
unsigned int uint
Definition: numeric.h:23
nap::ImageData::mAllocationInfo
VmaAllocationInfo mAllocationInfo
Vulkan memory allocation information.
Definition: imagedata.h:65
nap::ImageData::getImage
VkImage getImage() const
Definition: imagedata.h:50
nap::ImageData::getSubView
VkImageView getSubView(uint index) const
Definition: imagedata.h:40
nap::ImageData
Definition: imagedata.h:23
nap::ImageData::mSubViews
std::vector< VkImageView > mSubViews
Vulkan Image views.
Definition: imagedata.h:67
nap::ImageData::getView
VkImageView getView() const
Definition: imagedata.h:35
nap::ImageData::ImageData
ImageData(uint viewCount)
Definition: imagedata.h:29
nap
Definition: templateapp.h:17
nap::ImageData::getLayout
VkImageLayout getLayout() const
Definition: imagedata.h:55
nap::ImageData::getSubViewCount
uint getSubViewCount() const
Definition: imagedata.h:45