VPP  0.8
A high-level modern C++ API for Vulkan
vppImageInfo.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
36 {
41 };
42 
43 // -----------------------------------------------------------------------------
44 
45 enum EImageType
46 {
47  IMG_TYPE_1D,
48  IMG_TYPE_2D,
49  IMG_TYPE_3D,
50  IMG_TYPE_CUBE_2D,
51  IMG_TYPE_RECT_2D
52 };
53 
54 // -----------------------------------------------------------------------------
64 struct ImageInfo
65 {
83  ImageInfo (
84  EImagePurpose _purpose,
85  EImageType _type,
86  VkFormat _format,
87  const VkExtent3D& _extent,
88  unsigned int _mipLevels,
89  unsigned int _arrayLayers,
90  VkSampleCountFlagBits _multisampling,
91  VkImageTiling _tiling,
92  unsigned int _usage,
93  unsigned int _flags );
94 
109  ImageInfo (
110  unsigned int width,
111  unsigned int height,
112  EImagePurpose _purpose,
113  unsigned int usage,
114  VkFormat fmt );
115 
117  std::uint32_t getAspect() const;
118 
120  VkImageViewType getViewType() const;
121 
123  VkImageType getImageType() const;
124 
126  std::uint32_t getDimensions() const;
127 
129  bool operator< ( const ImageInfo& rhs ) const;
130 
132  bool operator== ( const ImageInfo& rhs ) const;
133 
135  bool operator!= ( const ImageInfo& rhs ) const;
136 
139 
141  EImageType type;
142 
144  VkFormat format;
145 
147  VkExtent3D extent;
148 
150  unsigned int mipLevels;
151 
153  unsigned int arrayLayers;
154 
156  VkSampleCountFlagBits multisampling;
157 
159  VkImageTiling tiling;
160 
162  unsigned int usage;
163 
165  unsigned int flags;
166 };
167 
168 // -----------------------------------------------------------------------------
169 } // namespace vpp
170 // -----------------------------------------------------------------------------
bool operator==(const ImageInfo &rhs) const
Comparison operator for equality.
std::uint32_t getAspect() const
Retrieves default aspect mask guessed from format.
A structure containing image parameters.
Definition: vppImageInfo.hpp:64
bool operator!=(const ImageInfo &rhs) const
Comparison operator for inequality.
unsigned int mipLevels
Number of levels in a mip-mapped image.
Definition: vppImageInfo.hpp:150
The VPP namespace.
Definition: main.hpp:1
unsigned int usage
Usage flags - bitwise or of EUsageFlags values.
Definition: vppImageInfo.hpp:162
std::uint32_t getDimensions() const
Retrieves the number of image dimensions.
VkImageType getImageType() const
Retrieves Vulkan image type.
Special image created as a part of the swapchain.
Definition: vppImageInfo.hpp:39
VkImageViewType getViewType() const
Retrieves Vulkan view type from image type.
ImageInfo(EImagePurpose _purpose, EImageType _type, VkFormat _format, const VkExtent3D &_extent, unsigned int _mipLevels, unsigned int _arrayLayers, VkSampleCountFlagBits _multisampling, VkImageTiling _tiling, unsigned int _usage, unsigned int _flags)
Constructs an image info with all parameters.
Internally created image for debugging purposes.
Definition: vppImageInfo.hpp:40
VkImageTiling tiling
Image tiling - usually VK_IMAGE_TILING_OPTIMAL.
Definition: vppImageInfo.hpp:159
All images used for normal rendering.
Definition: vppImageInfo.hpp:37
VkFormat format
Image format. A value of Vulkan format enumeration.
Definition: vppImageInfo.hpp:144
unsigned int flags
Additional flags - by default 0.
Definition: vppImageInfo.hpp:165
bool operator<(const ImageInfo &rhs) const
Comparison operator for maps.
VkExtent3D extent
Image size.
Definition: vppImageInfo.hpp:147
EImagePurpose purpose
Overall purpose of an image. Usually RENDER or SWAPCHAIN.
Definition: vppImageInfo.hpp:138
EImagePurpose
Enumeration specifying general purpose of an image.
Definition: vppImageInfo.hpp:35
unsigned int arrayLayers
Number of layers in an arrayed image.
Definition: vppImageInfo.hpp:153
Tags an attachment to be associated with a swapchain image view.
Definition: vppImageInfo.hpp:38
EImageType type
Type of image. Determins the number of dimensions.
Definition: vppImageInfo.hpp:141
VkSampleCountFlagBits multisampling
Number of samples in a multisampled image.
Definition: vppImageInfo.hpp:156