Added VMA

This commit is contained in:
2026-09-30 01:31:59 -07:00
parent fc70475538
commit 97ff85ea8a
9 changed files with 118 additions and 119 deletions
+7 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include <imgui_impl_vulkan.h>
#include <vk_mem_alloc.h>
#include <memory>
#include <optional>
@@ -47,6 +48,7 @@ class Device {
void waitIdle() { this->device->waitIdle(); }
VmaAllocator getAllocator() const { return this->allocator; }
vk::CommandPool getCommandPool() const { return this->commandPool; }
vk::SurfaceKHR getSurface() const { return surface; }
vk::Queue getGraphicsQueue() const { return graphicsQueue; }
@@ -60,15 +62,13 @@ class Device {
return querySwapchainSupport(this->physicalDevice);
}
u32 findMemoryType(u32 typeFilter, vk::MemoryPropertyFlags properties);
vk::Format findSupportedFormat(const std::vector<vk::Format>& candidates,
vk::ImageTiling tiling,
vk::FormatFeatureFlags features);
void createBuffer(vk::DeviceSize size, vk::BufferUsageFlags usage,
vk::MemoryPropertyFlags properties, vk::Buffer& buffer,
vk::DeviceMemory& bufferMemory);
VmaAllocation& allocation);
vk::CommandBuffer beginSingleTimeCommands();
@@ -79,7 +79,7 @@ class Device {
void createImageWithInfo(const vk::ImageCreateInfo& imageInfo,
vk::MemoryPropertyFlags properties, vk::Image& image,
vk::DeviceMemory& imageMemory);
VmaAllocation& allocation);
void populateImGuiInitInfo(ImGui_ImplVulkan_InitInfo& initInfo);
@@ -100,6 +100,7 @@ class Device {
SwapchainSupportDetails querySwapchainSupport(vk::PhysicalDevice device);
void createLogicalDevice();
void createAllocator();
void createCommandPool();
vk::UniqueInstance instance;
@@ -111,6 +112,8 @@ class Device {
vk::PhysicalDevice physicalDevice = VK_NULL_HANDLE;
vk::UniqueDevice device;
VmaAllocator allocator = VK_NULL_HANDLE;
vk::Queue graphicsQueue;
vk::Queue presentQueue;