From ac77d8ed6dc7af5dcf71d9c2e86e0cacaf742bf5 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 09:57:42 -0700 Subject: [PATCH] [Impeller] Fallback to graphics queue is transfer queue is not available. On some devices (for example an Android Pixel 4), a dedicated transfer queue is not available. This should not be considered a fatal error - instead we should use the graphics queue for transfer. Fixes https://github.com/flutter/flutter/issues/123791 --- .../renderer/backend/vulkan/context_vk.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/impeller/renderer/backend/vulkan/context_vk.cc b/impeller/renderer/backend/vulkan/context_vk.cc index f2463d5ab1aa2..1497e47728e21 100644 --- a/impeller/renderer/backend/vulkan/context_vk.cc +++ b/impeller/renderer/backend/vulkan/context_vk.cc @@ -177,7 +177,7 @@ void ContextVK::Setup(Settings settings) { auto instance = vk::createInstanceUnique(instance_info); if (instance.result != vk::Result::eSuccess) { - VALIDATION_LOG << "Could not create instance: " + VALIDATION_LOG << "Could not create Vulkan instance: " << vk::to_string(instance.result); return; } @@ -217,9 +217,16 @@ void ContextVK::Setup(Settings settings) { auto compute_queue = PickQueue(physical_device.value(), vk::QueueFlagBits::eCompute); - if (!graphics_queue.has_value() || !transfer_queue.has_value() || - !compute_queue.has_value()) { - VALIDATION_LOG << "Could not pick device queues."; + if (!graphics_queue.has_value()) { + VALIDATION_LOG << "Could not pick graphics queue."; + return; + } + if (!transfer_queue.has_value()) { + FML_LOG(INFO) << "Dedicated transfer queue not avialable."; + transfer_queue = graphics_queue.value(); + } + if (!compute_queue.has_value()) { + VALIDATION_LOG << "Could not pick compute queue."; return; } @@ -355,7 +362,9 @@ void ContextVK::Setup(Settings settings) { SetDebugName(device_.get(), device_.get(), "ImpellerDevice"); SetDebugName(device_.get(), graphics_queue_, "ImpellerGraphicsQ"); SetDebugName(device_.get(), compute_queue_, "ImpellerComputeQ"); - SetDebugName(device_.get(), transfer_queue_, "ImpellerTransferQ"); + if (transfer_queue_ != graphics_queue_) { + SetDebugName(device_.get(), transfer_queue_, "ImpellerTransferQ"); + } } bool ContextVK::IsValid() const {