13 _image(image), _device(device), _extent(extent), _format(format), _swapchainImage(swapchainImage) {
14 if (
_image != VK_NULL_HANDLE) {
29 image._image = VK_NULL_HANDLE;
30 image._device =
nullptr;
31 image._extent = {0, 0};
32 image._requirements = {};
33 image._deviceMemory =
nullptr;
34 image._deviceMemoryOffset = 0;
35 image._format = VK_FORMAT_UNDEFINED;
50 image._image = VK_NULL_HANDLE;
51 image._device =
nullptr;
52 image._extent = {0, 0};
53 image._requirements = {};
54 image._deviceMemory =
nullptr;
55 image._deviceMemoryOffset = 0;
56 image._format = VK_FORMAT_UNDEFINED;
69 if (
_image != VK_NULL_HANDLE) {
70 vkDestroyImage(static_cast<VkDevice>(*
_device),
_image,
nullptr);
79 vkBindImageMemory(static_cast<VkDevice>(*
_device),
_image, static_cast<VkDeviceMemory>(deviceMemory), memoryOffset);
83 for (
auto format: formats) {
89 LUG_LOG.error(
"Image: Can't find supported format format given features");
90 return VK_FORMAT_UNDEFINED;
97 LUG_LOG.warn(
"Image::isFormatSupported: the format does not exists in physicalDeviceInfo->formatProperties");
101 const VkFormatProperties& formatProperties = physicalDeviceInfo->
formatProperties.at(format);
103 if (tiling == VK_IMAGE_TILING_LINEAR && (formatProperties.linearTilingFeatures & features) == features) {
105 }
else if (tiling == VK_IMAGE_TILING_OPTIMAL && (formatProperties.optimalTilingFeatures & features) == features) {
Image & operator=(const Image &)=delete
VkMemoryRequirements _requirements
void bindMemory(const DeviceMemory &deviceMemory, VkDeviceSize memoryOffset=0)
VkDeviceMemory _deviceMemory
const PhysicalDeviceInfo * getPhysicalDeviceInfo() const
static VkFormat findSupportedFormat(const Device &device, const std::set< VkFormat > &formats, VkImageTiling tiling, VkFormatFeatureFlags features)
std::unordered_map< VkFormat, VkFormatProperties > formatProperties
const DeviceMemory * _deviceMemory
static bool isFormatSupported(const Device &device, VkFormat format, VkImageTiling tiling, VkFormatFeatureFlags features)
VkDeviceSize _deviceMemoryOffset