Сделал минимальный GC для видеопамяти
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
#include "GPU_GarbageCollector.h"
|
||||
#include "Core/CoreInstance.hpp"
|
||||
#include "Log/Log.hpp"
|
||||
|
||||
@@ -872,13 +873,15 @@ void UwURenderEngine::draw_frame()
|
||||
vkWaitForFences(device_, 1, &in_flight_fences_[current_frame_], VK_TRUE, UINT64_MAX);
|
||||
vkResetFences(device_, 1, &in_flight_fences_[current_frame_]);
|
||||
|
||||
garbage_collector_->FreeHeap();
|
||||
|
||||
uint32_t image_index;
|
||||
vkAcquireNextImageKHR(device_, swapchain_, UINT64_MAX, image_available_semaphores_[current_frame_], VK_NULL_HANDLE, &image_index);
|
||||
|
||||
vkResetCommandBuffer(command_buffers_[current_frame_], 0);
|
||||
record_command_buffer(command_buffers_[current_frame_], image_index);
|
||||
|
||||
|
||||
update_uniform_buffer(current_frame_);
|
||||
record_command_buffer(command_buffers_[current_frame_], image_index);
|
||||
|
||||
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
VkSubmitInfo submit_info{};
|
||||
@@ -937,6 +940,7 @@ core_(core)
|
||||
allocate_index_buffer();
|
||||
create_sync_objects();
|
||||
|
||||
garbage_collector_.reset(new GPU_GarbageCollector(device_));
|
||||
model_manager_.reset(new ModelManager(physical_device_, device_));
|
||||
}
|
||||
|
||||
@@ -945,7 +949,7 @@ UwURenderEngine::~UwURenderEngine()
|
||||
vkDeviceWaitIdle(device_);
|
||||
|
||||
if (index_buffer_memory_ != VK_NULL_HANDLE)
|
||||
vkFreeMemory(device_, index_buffer_memory_, nullptr);
|
||||
vkFreeMemory(device_, index_buffer_memory_, nullptr);
|
||||
|
||||
if (index_buffer_ != VK_NULL_HANDLE)
|
||||
vkDestroyBuffer(device_, index_buffer_, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user