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
bool shaders_ready = true;
for (Shader* shader : stages) {
if (shader) {
shaders_ready &= shader->IsBuilt();
for (auto& shader : stages) {
if (shader && !shader->IsBuilt()) {
return false;
}
}
if (!shaders_ready) {
return false;
}
}
MICROPROFILE_SCOPE(Vulkan_Pipeline);

View File

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