vk_pipeline_cache: Reduce flickering on android

This commit is contained in:
GPUCode
2023-02-11 13:17:32 +02:00
parent e7a1318773
commit 96effa46e4

View File

@ -137,16 +137,23 @@ PipelineCache::GraphicsPipeline::~GraphicsPipeline() {
bool PipelineCache::GraphicsPipeline::Build(bool fail_on_compile_required) { bool PipelineCache::GraphicsPipeline::Build(bool fail_on_compile_required) {
if (fail_on_compile_required) { if (fail_on_compile_required) {
if (!instance.IsPipelineCreationCacheControlSupported()) {
return false;
}
// Check if all shader modules are ready // Check if all shader modules are ready
for (auto& shader : stages) { for (auto& shader : stages) {
if (shader && !shader->IsBuilt()) { if (shader && !shader->IsBuilt()) {
return false; return false;
} }
} }
if (!instance.IsPipelineCreationCacheControlSupported()) {
#if ANDROID
// Many android devices do not support the above extension.
// To avoid having lots of flickering, if all shaders are
// ready compile the pipeline anyway.
return Build();
#else
return false;
#endif
}
} }
MICROPROFILE_SCOPE(Vulkan_Pipeline); MICROPROFILE_SCOPE(Vulkan_Pipeline);