2022-07-19 18:41:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
#include <vulkan/vk_mem_alloc.h>
|
2022-11-26 16:44:16 +00:00
|
|
|
#include "VulkanDevice.h"
|
|
|
|
#include "exports.h"
|
2022-07-19 18:41:44 +00:00
|
|
|
|
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
namespace VkTools {
|
2022-07-19 18:41:44 +00:00
|
|
|
struct ManagedImage {
|
|
|
|
VkImage image;
|
|
|
|
VmaAllocation allocation;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ManagedBuffer {
|
|
|
|
VkBuffer buffer;
|
|
|
|
VmaAllocation allocation;
|
|
|
|
};
|
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
extern API VmaAllocator allocator;
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
ManagedImage createImage(VkFormat format, VkImageUsageFlags flags, VkExtent3D extent);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
VkSampler createSampler(VkFilter filters, VkSamplerAddressMode mode, uint32_t mipping, VkDevice device);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
VkImageView createImageView(VkImage image, VkFormat format, VkImageAspectFlags flags, uint32_t mipping, uint32_t layers,
|
|
|
|
VkDevice device);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
ManagedBuffer createGPUBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties,
|
|
|
|
VkDevice logicalDevice, VkPhysicalDevice physicalDevice, bool hostVisible = true);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
void immediateExecute(const std::function<void(const VkCommandBuffer &)> &execute, VulkanDevice *dev);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
2022-11-26 16:44:16 +00:00
|
|
|
void copyGPUBuffer(VkBuffer source, VkBuffer dest, VkDeviceSize length, VulkanDevice *dev);
|
2022-07-19 18:41:44 +00:00
|
|
|
|
|
|
|
}
|