[Impeller] disable input attachment / self dependency on Adreno 630 and older. (#161274)

Part of https://github.com/flutter/flutter/issues/161209

The input attachment self dependency is broken on 6XX series Adreno, and
without this change advanced blends do not work.
This commit is contained in:
Jonah Williams 2025-01-07 17:48:30 -08:00 committed by GitHub
parent f3633a942d
commit 5f2bf18183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 1 deletions

View File

@ -627,7 +627,7 @@ bool CapabilitiesVK::SupportsTextureToTextureBlits() const {
// |Capabilities|
bool CapabilitiesVK::SupportsFramebufferFetch() const {
return true;
return has_framebuffer_fetch_;
}
// |Capabilities|
@ -762,6 +762,7 @@ ISize CapabilitiesVK::GetMaximumRenderPassAttachmentSize() const {
void CapabilitiesVK::ApplyWorkarounds(const WorkaroundsVK& workarounds) {
has_primitive_restart_ = !workarounds.slow_primitive_restart_performance;
has_framebuffer_fetch_ = !workarounds.input_attachment_self_dependency_broken;
}
} // namespace impeller

View File

@ -304,6 +304,7 @@ class CapabilitiesVK final : public Capabilities,
ISize max_render_pass_attachment_size_ = ISize{0, 0};
bool has_triangle_fans_ = true;
bool has_primitive_restart_ = true;
bool has_framebuffer_fetch_ = true;
bool is_valid_ = false;
// The embedder.h API is responsible for providing the instance and device

View File

@ -194,4 +194,33 @@ TEST(DriverInfoVKTest, EnabledDevicesAdreno) {
EXPECT_FALSE(IsBadVersionTest("Adreno (TM) 702"));
}
bool CanUseFramebufferFetch(std::string_view driver_name, bool qc = true) {
auto const context =
MockVulkanContextBuilder()
.SetPhysicalPropertiesCallback(
[&driver_name, qc](VkPhysicalDevice device,
VkPhysicalDeviceProperties* prop) {
if (qc) {
prop->vendorID = 0x168C; // Qualcomm
} else {
prop->vendorID = 0x13B5; // ARM
}
driver_name.copy(prop->deviceName, driver_name.size());
prop->deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU;
})
.Build();
return !GetWorkaroundsFromDriverInfo(*context->GetDriverInfo())
.input_attachment_self_dependency_broken;
}
TEST(DriverInfoVKTest, CanUseFramebufferFetch) {
// Adreno no primitive restart on models as or older than 630.
EXPECT_FALSE(CanUseFramebufferFetch("Adreno (TM) 540", true));
EXPECT_FALSE(CanUseFramebufferFetch("Adreno (TM) 630", true));
EXPECT_TRUE(CanUseFramebufferFetch("Adreno (TM) 640", true));
EXPECT_TRUE(CanUseFramebufferFetch("Adreno (TM) 750", true));
EXPECT_TRUE(CanUseFramebufferFetch("Mali-G51", false));
}
} // namespace impeller::testing

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "impeller/renderer/backend/vulkan/workarounds_vk.h"
#include "impeller/renderer/backend/vulkan/driver_info_vk.h"
namespace impeller {
@ -17,6 +18,10 @@ WorkaroundsVK GetWorkaroundsFromDriverInfo(DriverInfoVK& driver_info) {
workarounds.slow_primitive_restart_performance = true;
workarounds.broken_mipmap_generation = true;
if (adreno_gpu.value() <= AdrenoGPU::kAdreno630) {
workarounds.input_attachment_self_dependency_broken = true;
}
if (adreno_gpu.value() >= AdrenoGPU::kAdreno702) {
workarounds.batch_submit_command_buffer_timeout = false;
}

View File

@ -23,6 +23,10 @@ struct WorkaroundsVK {
/// be logically combined.
bool batch_submit_command_buffer_timeout = false;
/// On older 600 Series Adreno the input attachment / self dependency
/// cycle for programmable blending is broken.
bool input_attachment_self_dependency_broken = false;
/// Almost all Adreno series GPU (from 600 up to 800) have problems
/// generating mipmaps, resulting in corruption of the mip levels.
/// See: