Extended the swapchain creation process
This commit is contained in:
parent
04763de733
commit
a3b498d11b
@ -3,7 +3,9 @@
|
||||
// Normal header
|
||||
|
||||
#include "types.h"
|
||||
#include <cstddef>
|
||||
#include <fmt/base.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
|
||||
struct FrameData {
|
||||
@ -391,6 +393,71 @@ void Engine::initSwapchain() {
|
||||
1
|
||||
};
|
||||
|
||||
// Hardcoding draw format to a 32 bit float
|
||||
|
||||
_drawImage.imageFormat = VK_FORMAT_R16G16B16A16_SFLOAT;
|
||||
_drawImage.imageExtent = drawImageExtent;
|
||||
|
||||
VkImageUsageFlags drawImageUsages {
|
||||
VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT |
|
||||
VK_IMAGE_USAGE_STORAGE_BIT |
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
|
||||
};
|
||||
|
||||
VkImageCreateInfo rImgInfo = {
|
||||
vkinit::imageCreateInfo(
|
||||
_drawImage.imageFormat,
|
||||
drawImageUsages,
|
||||
drawImageExtent
|
||||
)
|
||||
};
|
||||
|
||||
// Use the GPU local memory for the draw image
|
||||
VmaAllocationCreateInfo rImgAllocInfo = {
|
||||
.usage = VMA_MEMORY_USAGE_GPU_ONLY,
|
||||
.requiredFlags = VkMemoryPropertyFlags(VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
|
||||
};
|
||||
|
||||
vmaCreateImage(
|
||||
_allocator,
|
||||
&rImgInfo,
|
||||
&_drawImage.image,
|
||||
&_drawImage.allocation,
|
||||
nullptr
|
||||
);
|
||||
|
||||
VkImageViewCreateInfo rViewInfo = {
|
||||
vkinit::imageViewCreateInfo(
|
||||
_drawImage.imageFormat,
|
||||
_drawImage.image,
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT
|
||||
)
|
||||
};
|
||||
|
||||
VK_CHECK(
|
||||
vkCreateImageView(
|
||||
_device,
|
||||
&rViewInfo,
|
||||
nullptr,
|
||||
&_drawImage.imageView
|
||||
)
|
||||
);
|
||||
|
||||
// Add to deletion queues
|
||||
_mainDeletionQueue.pushFunction([=]() {
|
||||
vkDestroyImageView(
|
||||
_device,
|
||||
_drawImage.imageView,
|
||||
nullptr
|
||||
);
|
||||
vmaDestroyImage(
|
||||
_allocator,
|
||||
_drawImage.image,
|
||||
_drawImage.allocation
|
||||
);
|
||||
})
|
||||
|
||||
#ifdef DEBUG
|
||||
fmt::println("Swapchain initialized !");
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user