vk_graphics_pipeline: Fix async shader compilation
* We were actually waiting for the pipelines regardless of the setting, oops
This commit is contained in:
parent
a12b01105d
commit
fe724600ab
1 changed files with 6 additions and 4 deletions
|
@ -74,18 +74,20 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, RenderpassCache& r
|
||||||
GraphicsPipeline::~GraphicsPipeline() = default;
|
GraphicsPipeline::~GraphicsPipeline() = default;
|
||||||
|
|
||||||
bool GraphicsPipeline::TryBuild(bool wait_built) {
|
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) {
|
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(
|
const bool shaders_pending = std::any_of(
|
||||||
stages.begin(), stages.end(), [](Shader* shader) { return shader && !shader->IsDone(); });
|
stages.begin(), stages.end(), [](Shader* shader) { return shader && !shader->IsDone(); });
|
||||||
if (!wait_built && shaders_pending) {
|
if (!wait_built && shaders_pending) {
|
||||||
return false;
|
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)) {
|
if (!wait_built && instance.IsPipelineCreationCacheControlSupported() && Build(true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +95,7 @@ bool GraphicsPipeline::TryBuild(bool wait_built) {
|
||||||
// Fallback to (a)synchronous compilation
|
// Fallback to (a)synchronous compilation
|
||||||
worker->QueueWork([this] { Build(); });
|
worker->QueueWork([this] { Build(); });
|
||||||
is_pending = true;
|
is_pending = true;
|
||||||
return true;
|
return wait_built;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicsPipeline::Build(bool fail_on_compile_required) {
|
bool GraphicsPipeline::Build(bool fail_on_compile_required) {
|
||||||
|
|
Loading…
Reference in a new issue