fix: alot of stuff changed. Mostly bugfixxes / architechture changes

This commit is contained in:
2026-08-09 02:24:17 +02:00
parent 4b6f773c0c
commit 05384debbf
98 changed files with 5461 additions and 1751 deletions
+46 -20
View File
@@ -1,5 +1,6 @@
#include <cassert>
#include <limits>
#include <stdexcept>
#include <destrum/Graphics/ImmediateExecuter.h>
#include <volk.h>
@@ -14,36 +15,61 @@ constexpr auto NO_TIMEOUT = std::numeric_limits<std::uint64_t>::max();
}
void VulkanImmediateExecutor::init(
VkDevice device,
VkDevice deviceHandle,
std::uint32_t graphicsQueueFamily,
VkQueue graphicsQueue)
VkQueue graphicsQueueHandle)
{
assert(!initialized);
if (initialized) {
throw std::logic_error("VulkanImmediateExecutor::init called twice");
}
this->device = device;
this->graphicsQueue = graphicsQueue;
this->device = deviceHandle;
this->graphicsQueue = graphicsQueueHandle;
const auto poolCreateInfo = vkinit::
commandPoolCreateInfo(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, graphicsQueueFamily);
VK_CHECK(vkCreateCommandPool(device, &poolCreateInfo, nullptr, &immCommandPool));
try {
const auto poolCreateInfo = vkinit::
commandPoolCreateInfo(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, graphicsQueueFamily);
VK_CHECK(vkCreateCommandPool(deviceHandle, &poolCreateInfo, nullptr, &immCommandPool));
const auto cmdAllocInfo = vkinit::commandBufferAllocateInfo(immCommandPool, 1);
VK_CHECK(vkAllocateCommandBuffers(device, &cmdAllocInfo, &immCommandBuffer));
const auto cmdAllocInfo = vkinit::commandBufferAllocateInfo(immCommandPool, 1);
VK_CHECK(vkAllocateCommandBuffers(deviceHandle, &cmdAllocInfo, &immCommandBuffer));
constexpr auto fenceCreateInfo = VkFenceCreateInfo{
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.flags = VK_FENCE_CREATE_SIGNALED_BIT,
};
VK_CHECK(vkCreateFence(device, &fenceCreateInfo, nullptr, &immFence));
constexpr auto fenceCreateInfo = VkFenceCreateInfo{
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.flags = VK_FENCE_CREATE_SIGNALED_BIT,
};
VK_CHECK(vkCreateFence(deviceHandle, &fenceCreateInfo, nullptr, &immFence));
initialized = true;
initialized = true;
} catch (...) {
cleanup(deviceHandle);
throw;
}
}
void VulkanImmediateExecutor::cleanup(VkDevice device)
void VulkanImmediateExecutor::cleanup(VkDevice deviceHandle)
{
assert(initialized);
vkDestroyCommandPool(device, immCommandPool, nullptr);
vkDestroyFence(device, immFence, nullptr);
if (deviceHandle == VK_NULL_HANDLE && device != VK_NULL_HANDLE) {
deviceHandle = device;
}
if (deviceHandle == VK_NULL_HANDLE) {
return;
}
if (immCommandPool != VK_NULL_HANDLE) {
vkDestroyCommandPool(deviceHandle, immCommandPool, nullptr);
}
if (immFence != VK_NULL_HANDLE) {
vkDestroyFence(deviceHandle, immFence, nullptr);
}
immCommandPool = VK_NULL_HANDLE;
immCommandBuffer = VK_NULL_HANDLE;
immFence = VK_NULL_HANDLE;
this->device = VK_NULL_HANDLE;
graphicsQueue = VK_NULL_HANDLE;
initialized = false;
}
void VulkanImmediateExecutor::immediateSubmit(