vk_graphics_pipeline: Fix async shader compilation

* We were actually waiting for the pipelines regardless of the setting, oops
This commit is contained in:
GPUCode 2023-08-19 22:49:29 +03:00
parent a12b01105d
commit fe724600ab

View file

@ -74,18 +74,20 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, RenderpassCache& r
GraphicsPipeline::~GraphicsPipeline() = default;
bool GraphicsPipeline::TryBuild(bool wait_built) {
// The pipeline is currently being compiled. We can either wait for it
// or skip the draw.
if (is_pending) {
return true;
return wait_built;
}
// If the shaders haven't been compiled yet, we cannot proceed
// If the shaders haven't been compiled yet, we cannot proceed.
const bool shaders_pending = std::any_of(
stages.begin(), stages.end(), [](Shader* shader) { return shader && !shader->IsDone(); });
if (!wait_built && shaders_pending) {
return false;
}
// Ask the driver if it can give us the pipeline quickly
// Ask the driver if it can give us the pipeline quickly.
if (!wait_built && instance.IsPipelineCreationCacheControlSupported() && Build(true)) {
return true;
}
@ -93,7 +95,7 @@ bool GraphicsPipeline::TryBuild(bool wait_built) {
// Fallback to (a)synchronous compilation
worker->QueueWork([this] { Build(); });
is_pending = true;
return true;
return wait_built;
}
bool GraphicsPipeline::Build(bool fail_on_compile_required) {