Lugdunum  0.1.0
Image.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 
6 
7 namespace lug {
8 namespace Graphics {
9 namespace Vulkan {
10 namespace API {
11 
12 class Device;
13 
14 namespace Builder {
15 
16 class Image {
17 public:
18  Image(const API::Device& device);
19 
20  Image(const Image&) = delete;
21  Image(Image&&) = delete;
22 
23  Image& operator=(const Image&) = delete;
24  Image& operator=(Image&&) = delete;
25 
26  ~Image() = default;
27 
28  // Setters
29  void setCreateFlags(VkImageCreateFlags createFlags);
30  void setImageType(VkImageType imageType);
31  void setPreferedFormats(const std::set<VkFormat>& preferedFormats);
32  void setFeatureFlags(VkFormatFeatureFlags featureFlags);
33  void setExtent(VkExtent3D extent);
34  void setMipLevels(uint32_t mipLevels);
35  void setArrayLayers(uint32_t arrayLayers);
36  void setSampleCount(VkSampleCountFlagBits sampleCount);
37  void setTiling(VkImageTiling tiling);
38  void setUsage(VkImageUsageFlags usage);
39  void setExclusive(bool exclusive);
40  void setQueueFamilyIndices(const std::set<uint32_t>& queueFamilyIndices);
41 
42  // Build methods
43  bool build(API::Image& instance, VkResult* returnResult = nullptr);
44  std::unique_ptr<API::Image> build(VkResult* returnResult = nullptr);
45 
46 private:
48 
49  VkImageCreateFlags _createFlags{0};
50  VkImageType _imageType{VK_IMAGE_TYPE_2D};
51  std::set<VkFormat> _preferedFormats;
52  VkFormatFeatureFlags _featureFlags{0};
53  VkExtent3D _extent{};
54  uint32_t _mipLevels{1};
55  uint32_t _arrayLayers{1};
56  VkSampleCountFlagBits _sampleCount{VK_SAMPLE_COUNT_1_BIT};
57  VkImageTiling _tiling{VK_IMAGE_TILING_OPTIMAL};
58  VkImageUsageFlags _usage{VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT};
59  bool _exclusive{false};
60  std::set<uint32_t> _queueFamilyIndices;
61  VkImageLayout _initialLayout{VK_IMAGE_LAYOUT_UNDEFINED};
62 };
63 
65 
66 } // Builder
67 } // API
68 } // Vulkan
69 } // Graphics
70 } // lug
std::set< VkFormat > _preferedFormats
Definition: Image.hpp:51
void setMipLevels(uint32_t mipLevels)
Definition: Image.inl:21
void setFeatureFlags(VkFormatFeatureFlags featureFlags)
Definition: Image.inl:13
void setExtent(VkExtent3D extent)
Definition: Image.inl:17
Image(const API::Device &device)
Definition: Image.cpp:14
Image & operator=(const Image &)=delete
std::set< uint32_t > _queueFamilyIndices
Definition: Image.hpp:60
void setTiling(VkImageTiling tiling)
Definition: Image.inl:33
VkFormatFeatureFlags _featureFlags
Definition: Image.hpp:52
void setUsage(VkImageUsageFlags usage)
Definition: Image.inl:37
void setImageType(VkImageType imageType)
Definition: Image.inl:5
VkSampleCountFlagBits _sampleCount
Definition: Image.hpp:56
void setQueueFamilyIndices(const std::set< uint32_t > &queueFamilyIndices)
Definition: Image.inl:45
void setSampleCount(VkSampleCountFlagBits sampleCount)
Definition: Image.inl:29
void setCreateFlags(VkImageCreateFlags createFlags)
Definition: Image.inl:1
void setPreferedFormats(const std::set< VkFormat > &preferedFormats)
Definition: Image.inl:9
bool build(API::Image &instance, VkResult *returnResult=nullptr)
Definition: Image.cpp:16
void setArrayLayers(uint32_t arrayLayers)
Definition: Image.inl:25