Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions ZEngine/ZEngine/Hardwares/VulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,6 @@ namespace ZEngine::Hardwares
VmaAllocatorCreateInfo vma_allocator_create_info = {.physicalDevice = PhysicalDevice, .device = LogicalDevice, .instance = Instance, .vulkanApiVersion = VK_API_VERSION_1_3};
ZENGINE_VALIDATE_ASSERT(vmaCreateAllocator(&vma_allocator_create_info, &VmaAllocatorValue) == VK_SUCCESS, "Failed to create VMA Allocator")

m_buffer_manager.Initialize(this);
EnqueuedCommandbuffers.init(Arena, m_buffer_manager.TotalCommandBufferCount, m_buffer_manager.TotalCommandBufferCount);

/*
* Creating Swapchain
*/
Expand All @@ -428,6 +425,8 @@ namespace ZEngine::Hardwares
PreviousFrameIndex = 0;
CurrentFrameIndex = 0;

CreateSwapchain();

SwapchainRenderCompleteSemaphores.init(Arena, SwapchainImageCount, SwapchainImageCount);
SwapchainAcquiredSemaphores.init(Arena, SwapchainImageCount, SwapchainImageCount);
SwapchainSignalFences.init(Arena, SwapchainImageCount, SwapchainImageCount);
Expand All @@ -438,7 +437,6 @@ namespace ZEngine::Hardwares
SwapchainRenderCompleteSemaphores[i] = ZPushStructCtorArgs(Arena, Primitives::Semaphore, this);
SwapchainSignalFences[i] = ZPushStructCtorArgs(Arena, Primitives::Fence, this, true);
}
CreateSwapchain();

/*
* Creating Global Descriptor Pool for : Textures
Expand Down Expand Up @@ -1242,6 +1240,9 @@ namespace ZEngine::Hardwares
SwapchainFramebuffers.init(Arena, SwapchainImageCount, SwapchainImageCount);
}

m_buffer_manager.Initialize(this);
EnqueuedCommandbuffers.init(Arena, m_buffer_manager.TotalCommandBufferCount, m_buffer_manager.TotalCommandBufferCount);

scratch = ZGetScratch(Arena);

Array<VkImage> SwapchainImages = {};
Expand Down Expand Up @@ -2004,10 +2005,10 @@ namespace ZEngine::Hardwares
}
}

void CommandBufferManager::Initialize(VulkanDevice* device, uint8_t swapchain_image_count, int thread_count)
void CommandBufferManager::Initialize(VulkanDevice* device, int thread_count)
{
Device = device;
m_total_pool_count = swapchain_image_count * thread_count;
m_total_pool_count = device->SwapchainImageCount * thread_count;
TotalCommandBufferCount = m_total_pool_count * MaxBufferPerPool;
m_instant_fence = ZPushStructCtorArgs(Device->Arena, Primitives::Fence, device);
m_instant_semaphore = ZPushStructCtorArgs(Device->Arena, Primitives::Semaphore, device);
Expand Down