vk_swapchain: Prefer scheduler finish

* The scheduler might have recorded a present that uses the to-be-destroyed semaphores. vkWaitIdle might miss this
This commit is contained in:
GPUCode
2023-01-17 22:24:03 +02:00
parent 4752818920
commit cbd9a6ffe3
2 changed files with 5 additions and 11 deletions

View File

@ -149,16 +149,11 @@ bool PipelineCache::GraphicsPipeline::Build(bool fail_on_compile_required) {
} }
// Check if all shader modules are ready // Check if all shader modules are ready
bool shaders_ready = true; for (auto& shader : stages) {
for (Shader* shader : stages) { if (shader && !shader->IsBuilt()) {
if (shader) { return false;
shaders_ready &= shader->IsBuilt();
} }
} }
if (!shaders_ready) {
return false;
}
} }
MICROPROFILE_SCOPE(Vulkan_Pipeline); MICROPROFILE_SCOPE(Vulkan_Pipeline);

View File

@ -43,8 +43,7 @@ Swapchain::~Swapchain() {
} }
void Swapchain::Create(vk::SurfaceKHR new_surface) { void Swapchain::Create(vk::SurfaceKHR new_surface) {
vk::Device device = instance.GetDevice(); scheduler.Finish();
device.waitIdle();
Destroy(); Destroy();
if (new_surface) { if (new_surface) {
@ -82,7 +81,7 @@ void Swapchain::Create(vk::SurfaceKHR new_surface) {
}; };
try { try {
swapchain = device.createSwapchainKHR(swapchain_info); swapchain = instance.GetDevice().createSwapchainKHR(swapchain_info);
} catch (vk::SystemError& err) { } catch (vk::SystemError& err) {
LOG_CRITICAL(Render_Vulkan, "{}", err.what()); LOG_CRITICAL(Render_Vulkan, "{}", err.what());
UNREACHABLE(); UNREACHABLE();