diff --git a/engine/src/flutter/common/graphics/BUILD.gn b/engine/src/flutter/common/graphics/BUILD.gn index 480aefb234..ac799633bb 100644 --- a/engine/src/flutter/common/graphics/BUILD.gn +++ b/engine/src/flutter/common/graphics/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//flutter/common/config.gni") +import("//flutter/shell/config.gni") import("//flutter/testing/testing.gni") source_set("graphics") { @@ -29,8 +30,8 @@ source_set("graphics") { "//third_party/skia", ] - public_configs = [ - "//flutter:config", - "//flutter/vulkan:vulkan_config", - ] + public_configs = [ "//flutter:config" ] + if (shell_enable_vulkan) { + public_configs += [ "//flutter/vulkan:vulkan_config" ] + } } diff --git a/engine/src/flutter/display_list/testing/BUILD.gn b/engine/src/flutter/display_list/testing/BUILD.gn index fabb290068..e1965e8c4a 100644 --- a/engine/src/flutter/display_list/testing/BUILD.gn +++ b/engine/src/flutter/display_list/testing/BUILD.gn @@ -29,7 +29,7 @@ surface_provider_include_software = !is_android && !is_ios # But, since benchmarks do not run on Windows and rendertests only # runs on SW by default, this restriction currently only limits the # ability to manually cross-check OpenGL on Windows for rendertests -surface_provider_include_gl = !is_fuchsia && !is_ios && !is_win +surface_provider_include_gl = !is_fuchsia && !is_ios && !is_win && !is_mac # TODO (https://github.com/flutter/flutter/issues/107357): # impeller_enable_vulkan currently requires skia to not use VMA, which in turn diff --git a/engine/src/flutter/flow/BUILD.gn b/engine/src/flutter/flow/BUILD.gn index c3261cbe9f..1adceefde4 100644 --- a/engine/src/flutter/flow/BUILD.gn +++ b/engine/src/flutter/flow/BUILD.gn @@ -4,6 +4,7 @@ import("//build/fuchsia/sdk.gni") import("//flutter/common/config.gni") +import("//flutter/shell/config.gni") import("//flutter/testing/testing.gni") source_set("flow") { @@ -85,10 +86,10 @@ source_set("flow") { "surface_frame.h", ] - public_configs = [ - "//flutter:config", - "//flutter/vulkan:vulkan_config", - ] + public_configs = [ "//flutter:config" ] + if (shell_enable_vulkan) { + public_configs += [ "//flutter/vulkan:vulkan_config" ] + } deps = [ "//flutter/common", diff --git a/engine/src/flutter/impeller/renderer/compute_subgroup_unittests.cc b/engine/src/flutter/impeller/renderer/compute_subgroup_unittests.cc index e0f6b86dfe..39c36c6ce2 100644 --- a/engine/src/flutter/impeller/renderer/compute_subgroup_unittests.cc +++ b/engine/src/flutter/impeller/renderer/compute_subgroup_unittests.cc @@ -32,7 +32,9 @@ namespace testing { using ComputeTest = ComputePlaygroundTest; INSTANTIATE_COMPUTE_SUITE(ComputeTest); -TEST_P(ComputeTest, HeartCubicsToStrokeVertices) { +// TODO(dnfield): Re-enable +// https://github.com/flutter/flutter/issues/122828 +TEST_P(ComputeTest, DISABLED_HeartCubicsToStrokeVertices) { using CS = CubicToQuadsComputeShader; using QS = QuadPolylineComputeShader; using SS = StrokeComputeShader; @@ -256,7 +258,9 @@ TEST_P(ComputeTest, HeartCubicsToStrokeVertices) { ASSERT_TRUE(OpenPlaygroundHere(callback)); } -TEST_P(ComputeTest, QuadsToPolyline) { +// TODO(dnfield): Re-enable +// https://github.com/flutter/flutter/issues/122828 +TEST_P(ComputeTest, DISABLED_QuadsToPolyline) { using QS = QuadPolylineComputeShader; auto context = GetContext(); ASSERT_TRUE(context); diff --git a/engine/src/flutter/impeller/tools/impeller.gni b/engine/src/flutter/impeller/tools/impeller.gni index 818a65ce29..c9a46c15a2 100644 --- a/engine/src/flutter/impeller/tools/impeller.gni +++ b/engine/src/flutter/impeller/tools/impeller.gni @@ -15,10 +15,10 @@ declare_args() { impeller_enable_metal = is_mac || is_ios # Whether the OpenGLES backend is enabled. - impeller_enable_opengles = is_mac || is_linux || is_win || is_android + impeller_enable_opengles = is_linux || is_win || is_android # Whether the Vulkan backend is enabled. - impeller_enable_vulkan = is_mac || is_linux || is_win || is_android + impeller_enable_vulkan = is_linux || is_win || is_android # Whether to use a prebuilt impellerc. # If this is the empty string, impellerc will be built. @@ -679,6 +679,7 @@ template("impeller_shaders") { } if (impeller_enable_metal) { + not_needed(invoker, [ "analyze" ]) mtl_shaders = "mtl_$target_name" _impeller_shaders_metal(mtl_shaders) { name = invoker.name diff --git a/engine/src/flutter/impeller/typographer/typographer_unittests.cc b/engine/src/flutter/impeller/typographer/typographer_unittests.cc index e8b6258fe3..01a11d494c 100644 --- a/engine/src/flutter/impeller/typographer/typographer_unittests.cc +++ b/engine/src/flutter/impeller/typographer/typographer_unittests.cc @@ -168,7 +168,9 @@ TEST_P(TypographerTest, GlyphAtlasWithLotsOfdUniqueGlyphSize) { atlas->GetTexture()->GetSize().height); } -TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) { +// TODO(jonahwilliams): Re-enable +// https://github.com/flutter/flutter/issues/122839 +TEST_P(TypographerTest, DISABLED_GlyphAtlasTextureIsRecycledIfUnchanged) { auto context = TextRenderContext::Create(GetContext()); auto atlas_context = std::make_shared(); ASSERT_TRUE(context && context->IsValid()); @@ -186,7 +188,7 @@ TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledIfUnchanged) { auto* first_texture = atlas->GetTexture().get(); - // now create a new glyph atlas with a nearly identical blob. + // Now create a new glyph atlas with a nearly identical blob. auto blob2 = SkTextBlob::MakeFromString("spooky 2", sk_font); auto next_atlas = diff --git a/engine/src/flutter/lib/ui/BUILD.gn b/engine/src/flutter/lib/ui/BUILD.gn index 121375ada5..b360fc81ff 100644 --- a/engine/src/flutter/lib/ui/BUILD.gn +++ b/engine/src/flutter/lib/ui/BUILD.gn @@ -5,6 +5,7 @@ import("//build/fuchsia/sdk.gni") import("//flutter/common/config.gni") import("//flutter/impeller/tools/impeller.gni") +import("//flutter/shell/config.gni") import("//flutter/testing/testing.gni") source_set("ui") { @@ -270,7 +271,7 @@ if (enable_unittests) { ] # TODO(https://github.com/flutter/flutter/issues/63837): This test is hard-coded to use a TestGLSurface so it cannot run on fuchsia. - if (!is_fuchsia) { + if (shell_enable_gl) { sources += [ "painting/image_decoder_unittests.cc" ] deps += [ "//flutter/testing:opengl" ] diff --git a/engine/src/flutter/shell/common/BUILD.gn b/engine/src/flutter/shell/common/BUILD.gn index d0255379bd..32d63365b4 100644 --- a/engine/src/flutter/shell/common/BUILD.gn +++ b/engine/src/flutter/shell/common/BUILD.gn @@ -319,14 +319,11 @@ if (enable_unittests) { "$fuchsia_sdk_root/pkg:fidl_cpp", "$fuchsia_sdk_root/pkg:sys_cpp", ] - } else { - # TODO(63837): This test is hard-coded to use a TestGLSurface so it cannot run on fuchsia. + } else if (shell_enable_gl) { + # TODO(63837): This test is hard-coded to use a TestGLSurface so it cannot + # run on fuchsia or when GL is not enabled. sources += [ "shell_io_manager_unittests.cc" ] - - # Swiftshader only needed on non-Fuchsia platforms. - if (shell_enable_vulkan) { - deps += [ "//third_party/swiftshader" ] - } + deps += [ "//third_party/swiftshader" ] } if (shell_enable_gl) { diff --git a/engine/src/flutter/shell/common/shell_io_manager_unittests.cc b/engine/src/flutter/shell/common/shell_io_manager_unittests.cc index b1ac2ed665..de880b1630 100644 --- a/engine/src/flutter/shell/common/shell_io_manager_unittests.cc +++ b/engine/src/flutter/shell/common/shell_io_manager_unittests.cc @@ -10,7 +10,7 @@ #include "flutter/testing/dart_isolate_runner.h" #include "flutter/testing/fixture_test.h" #include "flutter/testing/post_task_sync.h" -#include "flutter/testing/test_gl_surface.h" +#include "flutter/testing/test_gl_surface.h" // nogncheck #include "flutter/testing/testing.h" namespace flutter { diff --git a/engine/src/flutter/shell/common/shell_unittests.cc b/engine/src/flutter/shell/common/shell_unittests.cc index 2d1b4f01f9..aac516ad37 100644 --- a/engine/src/flutter/shell/common/shell_unittests.cc +++ b/engine/src/flutter/shell/common/shell_unittests.cc @@ -1732,6 +1732,9 @@ TEST_F(ShellTest, SetResourceCacheSize) { #if defined(SHELL_ENABLE_VULKAN) && !defined(SHELL_ENABLE_GL) EXPECT_EQ(GetRasterizerResourceCacheBytesSync(*shell), vulkan::kGrCacheMaxByteSize); +#elif defined(SHELL_ENABLE_METAL) + EXPECT_EQ(GetRasterizerResourceCacheBytesSync(*shell), + static_cast(256 * (1 << 20))); #else EXPECT_EQ(GetRasterizerResourceCacheBytesSync(*shell), static_cast(24 * (1 << 20))); @@ -2571,12 +2574,74 @@ TEST_F(ShellTest, OnServiceProtocolRenderFrameWithRasterStatsWorks) { // It would be better to parse out the json and check for the validity of // fields. Below checks approximate what needs to be checked, this can not be // an exact check since duration will not exactly match. +#ifdef SHELL_ENABLE_METAL + std::string expected_json = + "\"snapshot\":[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,3,32,0," + "0,2,88,8,6,0,0,0,154,118,130,112,0,0,0,1,115,82,71,66,0,174,206,28,233," + "0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,7,103,73,68,65,84,120," + "156,237,206,65,13,192,48,0,3,177,211,248,115,78,73,172,234,199,70,224," + "86,91,45,0,0,128,203,190,215,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0," + "0,224,47,7,195,182,3,255,101,111,186,90,0,0,0,0,73,69,78,68,174,66,96," + "130]"; +#else std::string expected_json = "\"snapshot\":[137,80,78,71,13,10,26,10,0," "0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,6,0,0,0,31,21,196,137,0,0,0,1,115," "82,71,66,0,174,206,28,233,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0," "0,0,13,73,68,65,84,8,153,99,248,207,192,240,31,0,5,0,1,255,171,206,54," "137,0,0,0,0,73,69,78,68,174,66,96,130]"; +#endif std::string actual_json = buffer.GetString(); EXPECT_THAT(actual_json, ::testing::HasSubstr(expected_json)); diff --git a/engine/src/flutter/shell/config.gni b/engine/src/flutter/shell/config.gni index 85dd360cbc..3f498d2c04 100644 --- a/engine/src/flutter/shell/config.gni +++ b/engine/src/flutter/shell/config.gni @@ -3,7 +3,7 @@ # found in the LICENSE file. declare_args() { - shell_enable_gl = !is_fuchsia + shell_enable_gl = !is_fuchsia && !is_mac # The logic for enabling Vulkan and Metal is in tools/gn. shell_enable_metal = false diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 4007bb9e0c..104775a4fe 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -46,7 +46,13 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) { GTEST_SKIP() << "This test crashes on Fuchsia. https://fxbug.dev/87493 "; #endif // OS_FUCHSIA +#ifdef SHELL_ENABLE_GL auto& context = GetEmbedderContext(EmbedderTestContextType::kOpenGLContext); +#elif SHELL_ENABLE_METAL + auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext); +#else + auto& context = GetEmbedderContext(EmbedderTestContextType::kSoftwareContext); +#endif fml::AutoResetWaitableEvent signal_native_latch; @@ -222,7 +228,13 @@ TEST_F(EmbedderA11yTest, A11yTreeIsConsistent) { } TEST_F(EmbedderA11yTest, A11yTreeIsConsistentUsingLegacyCallbacks) { +#ifdef SHELL_ENABLE_GL auto& context = GetEmbedderContext(EmbedderTestContextType::kOpenGLContext); +#elif SHELL_ENABLE_METAL + auto& context = GetEmbedderContext(EmbedderTestContextType::kMetalContext); +#else + auto& context = GetEmbedderContext(EmbedderTestContextType::kSoftwareContext); +#endif fml::AutoResetWaitableEvent signal_native_latch; diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.cc index 52764b4452..232615b7da 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_config_builder.cc @@ -8,7 +8,6 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "tests/embedder_test_context.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "vulkan/vulkan_core.h" #ifdef SHELL_ENABLE_GL #include "flutter/shell/platform/embedder/tests/embedder_test_compositor_gl.h" @@ -17,7 +16,8 @@ #ifdef SHELL_ENABLE_VULKAN #include "flutter/shell/platform/embedder/tests/embedder_test_context_vulkan.h" -#include "flutter/vulkan/vulkan_device.h" +#include "flutter/vulkan/vulkan_device.h" // nogncheck +#include "vulkan/vulkan_core.h" // nogncheck #endif #ifdef SHELL_ENABLE_METAL diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_test.cc index 9a315dec3c..0b557d318e 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test.cc @@ -4,7 +4,6 @@ #include "flutter/shell/platform/embedder/tests/embedder_test.h" #include "flutter/shell/platform/embedder/tests/embedder_test_context_software.h" -#include "flutter/shell/platform/embedder/tests/embedder_test_context_vulkan.h" #ifdef SHELL_ENABLE_GL #include "flutter/shell/platform/embedder/tests/embedder_test_context_gl.h" @@ -14,6 +13,10 @@ #include "flutter/shell/platform/embedder/tests/embedder_test_context_metal.h" #endif +#ifdef SHELL_ENABLE_VULKAN +#include "flutter/shell/platform/embedder/tests/embedder_test_context_vulkan.h" +#endif + namespace flutter { namespace testing { diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h index 85c3a53e33..51b15f791b 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h @@ -18,7 +18,7 @@ #endif #ifdef SHELL_ENABLE_VULKAN -#include "flutter/testing/test_vulkan_context.h" +#include "flutter/testing/test_vulkan_context.h" // nogncheck #endif namespace flutter { diff --git a/engine/src/flutter/testing/BUILD.gn b/engine/src/flutter/testing/BUILD.gn index 84fab9e413..6ba34ebcc3 100644 --- a/engine/src/flutter/testing/BUILD.gn +++ b/engine/src/flutter/testing/BUILD.gn @@ -124,7 +124,7 @@ source_set("fixture_test") { } } -if (enable_unittests) { +if (enable_unittests && shell_enable_vulkan) { source_set("vulkan") { testonly = true @@ -153,7 +153,9 @@ if (enable_unittests) { configs += [ "//third_party/swiftshader:swiftshader_config" ] } } +} +if (enable_unittests) { test_fixtures("testing_fixtures") { fixtures = [] } @@ -170,7 +172,6 @@ if (enable_unittests) { ":testing", ":testing_fixtures", "//flutter/runtime:libdart", - "//flutter/vulkan", ] if (shell_enable_metal) { @@ -178,6 +179,10 @@ if (enable_unittests) { deps += [ ":metal" ] } + + if (shell_enable_vulkan) { + deps += [ "//flutter/vulkan" ] + } } } @@ -207,7 +212,7 @@ if (is_mac || is_ios) { # Skia's Vulkan support is enabled for all platforms (except iOS), and so parts of # Skia's graphics context reference Vulkan symbols. - if (!is_ios) { + if (shell_enable_vulkan) { deps += [ "//flutter/vulkan" ] } } @@ -217,22 +222,21 @@ if (is_mac || is_ios) { } # We only use SwiftShader on unittests -use_swiftshader = enable_unittests && !is_fuchsia +use_swiftshader = enable_unittests && shell_enable_gl +if (use_swiftshader) { + source_set("opengl") { + testonly = true -source_set("opengl") { - testonly = true + sources = [ + "test_gl_surface.cc", + "test_gl_surface.h", + ] - sources = [ - "test_gl_surface.cc", - "test_gl_surface.h", - ] + deps = [ + ":skia", + "//flutter/fml", + ] - deps = [ - ":skia", - "//flutter/fml", - ] - - if (use_swiftshader) { configs -= [ "//build/config/clang:extra_warnings" ] configs += [ "//flutter/vulkan:vulkan_config", # for swiftshader diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index 9961cd1e53..98af755499 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -445,25 +445,25 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump): # TODO(117122): Re-enable impeller_unittests after shader compiler errors # are addressed. # Impeller tests are only supported on macOS for now. - # run_engine_executable( - # build_dir, - # 'impeller_unittests', - # executable_filter, - # shuffle_flags, - # coverage=coverage, - # extra_env={ - # # pylint: disable=line-too-long - # # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc - # 'MTL_SHADER_VALIDATION': - # '1', # Enables all shader validation tests. - # 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': - # '1', # Validates accesses to device and constant memory. - # 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': - # '1', # Validates accesses to threadgroup memory. - # 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': - # '1', # Validates that texture references are not nil. - # } - # ) + run_engine_executable( + build_dir, + 'impeller_unittests', + executable_filter, + shuffle_flags, + coverage=coverage, + extra_env={ + # pylint: disable=line-too-long + # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc + 'MTL_SHADER_VALIDATION': + '1', # Enables all shader validation tests. + 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': + '1', # Validates accesses to device and constant memory. + 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': + '1', # Validates accesses to threadgroup memory. + 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': + '1', # Validates that texture references are not nil. + } + ) def parse_impeller_vulkan_filter(): diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index 47664dd462..b2cadaf487 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -446,7 +446,7 @@ def to_gn_args(args): # Enable Vulkan on all platforms except for iOS. This is just # to save on mobile binary size, as there's no reason the Vulkan embedder # features can't work on these platforms. - if args.target_os not in ['ios']: + if gn_args['target_os'] not in ['ios', 'mac']: gn_args['skia_use_vulkan'] = True gn_args['skia_use_vma'] = False gn_args['shell_enable_vulkan'] = True