diff --git a/DEPS b/DEPS index 94e42b0058..4925c8e9eb 100644 --- a/DEPS +++ b/DEPS @@ -111,7 +111,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '09b25535a092e89d817a2808e7745c8d111c0be5', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '87d5dcb98983da54257f6f39d3beee2989cb0e47', # Fuchsia compatibility # @@ -137,26 +137,12 @@ deps = { 'src/third_party/shaderc': Var('github_git') + '/google/shaderc.git' + '@' + '948660cccfbbc303d2590c7f44a4cee40b66fdd6', - 'src/third_party/glslang': - Var('github_git') + '/KhronosGroup/glslang.git' + '@' + '9431c53c84c14fa9e9cd37678262ebba55c62c87', - - 'src/third_party/spirv_tools': - Var('github_git') + '/KhronosGroup/SPIRV-Tools.git' + '@' + '1020e394cb1267332d58497150d2b024371a8e41', - - 'src/third_party/spirv_headers': - Var('github_git') + '/KhronosGroup/SPIRV-Headers.git' + '@' + '85b7e00c7d785962ffe851a177c84353d037dcb6', - - 'src/third_party/spirv_cross': - Var('github_git') + '/KhronosGroup/SPIRV-Cross.git' + '@' + '418542eaefdb609f548d25a1e3962fb69d80da63', + 'src/third_party/vulkan-deps': + Var('chromium_git') + '/vulkan-deps' + '@' + '23b710f1a0b3c44d51035c6400a554415f95d9c6', 'src/third_party/flatbuffers': Var('github_git') + '/google/flatbuffers.git' + '@' + '967df08b1dbddc62f867464c2e0d58d8027438ad', - # Chromium-style - # - # As part of integrating with Fuchsia, we should eventually remove all these - # Chromium-style dependencies. - 'src/third_party/icu': Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '12de966fcbe1d1a48dba310aee63807856ffeee8', @@ -472,26 +458,19 @@ deps = { 'src/third_party/pyyaml': Var('fuchsia_git') + '/third_party/pyyaml.git' + '@' + '25e97546488eee166b1abb229a27856cecd8b7ac', - # Upstream Khronos Vulkan Headers (v1.1.130) - 'src/third_party/vulkan-headers': - Var('github_git') + '/KhronosGroup/Vulkan-Headers.git' + '@' + '0e57fc1cfa56a203efe43e4dfb9b3c9e9b105593', - - # Skia VMA dependency. - 'src/third_party/externals/vulkanmemoryallocator': - Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + '7de5cc00de50e71a3aab22dea52fbb7ff4efceb6', - + # Upstream Khronos Vulkan Headers are part of vulkan-deps # Downstream Fuchsia Vulkan Headers (v1.2.198) 'src/third_party/fuchsia-vulkan': Var('fuchsia_git') + '/third_party/Vulkan-Headers.git' + '@' + '32640ad82ef648768c706c9bf828b77123a09bc2', 'src/third_party/swiftshader': - Var('swiftshader_git') + '/SwiftShader.git' + '@' + 'd4130e9ac3675dadbec8442dc2310a80ea4ddfb2', + Var('swiftshader_git') + '/SwiftShader.git' + '@' + 'bea8d2471bd912220ba59032e0738f3364632657', 'src/third_party/angle': - Var('github_git') + '/google/angle.git' + '@' + 'acdec48addfdff315efff293be0d5e2e37e8e560', + Var('chromium_git') + '/angle/angle.git' + '@' + '3faaded8234b31dea24c929e40e33089a34a9aa5', - 'src/third_party/angle/third_party/vulkan-deps/vulkan-headers/src': - Var('fuchsia_git') + '/third_party/Vulkan-Headers.git' + '@' + '5de4e8fab88ef0bd6994d9ddbcc864e3179b9e79', + 'src/third_party/vulkan_memory_allocator': + Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator' + '@' + '7de5cc00de50e71a3aab22dea52fbb7ff4efceb6', 'src/third_party/abseil-cpp': Var('chromium_git') + '/chromium/src/third_party/abseil-cpp.git' + '@' + '2d8c1340f0350828f1287c4eaeebefcf317bcfc9', @@ -687,6 +666,10 @@ deps = { }, } +recursedeps = [ + 'src/third_party/vulkan-deps', +] + hooks = [ { # Generate the Dart SDK's .dart_tool/package_confg.json file. diff --git a/engine/src/flutter/ci/licenses_golden/tool_signature b/engine/src/flutter/ci/licenses_golden/tool_signature index 3256ee9e84..4ee9f38b11 100644 --- a/engine/src/flutter/ci/licenses_golden/tool_signature +++ b/engine/src/flutter/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 62f85bbfe0c4ce501a865747f7bb099e +Signature: 0be7d6e5107b5c14bae7579aafdcbb7e diff --git a/engine/src/flutter/examples/vulkan_glfw/BUILD.gn b/engine/src/flutter/examples/vulkan_glfw/BUILD.gn index ee3bf6b3a5..7930eff4be 100644 --- a/engine/src/flutter/examples/vulkan_glfw/BUILD.gn +++ b/engine/src/flutter/examples/vulkan_glfw/BUILD.gn @@ -12,5 +12,6 @@ executable("vulkan_glfw") { deps = [ "//flutter/shell/platform/embedder:embedder", "//third_party/glfw", + "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers", ] } diff --git a/engine/src/flutter/impeller/compiler/BUILD.gn b/engine/src/flutter/impeller/compiler/BUILD.gn index 4672912e12..54f2b8560b 100644 --- a/engine/src/flutter/impeller/compiler/BUILD.gn +++ b/engine/src/flutter/impeller/compiler/BUILD.gn @@ -6,6 +6,8 @@ import("//flutter/impeller/tools/impeller.gni") import("//flutter/shell/version/version.gni") impeller_component("compiler_lib") { + include_dirs = [ "//third_party/vulkan-deps/spirv-cross/src/" ] + sources = [ "code_gen_template.h", "compiler.cc", @@ -77,7 +79,7 @@ generated_file("impellerc_license") { "", "### spirv_cross", "", - read_file("//third_party/spirv_cross/LICENSE", "string"), + read_file("//third_party/vulkan-deps/spirv-cross/src/LICENSE", "string"), ] } diff --git a/engine/src/flutter/impeller/compiler/compiler.h b/engine/src/flutter/impeller/compiler/compiler.h index 635c778f28..67930967e5 100644 --- a/engine/src/flutter/impeller/compiler/compiler.h +++ b/engine/src/flutter/impeller/compiler/compiler.h @@ -15,8 +15,8 @@ #include "impeller/compiler/source_options.h" #include "impeller/compiler/types.h" #include "shaderc/shaderc.hpp" -#include "third_party/spirv_cross/spirv_msl.hpp" -#include "third_party/spirv_cross/spirv_parser.hpp" +#include "spirv_msl.hpp" +#include "spirv_parser.hpp" namespace impeller { namespace compiler { diff --git a/engine/src/flutter/impeller/compiler/compiler_backend.h b/engine/src/flutter/impeller/compiler/compiler_backend.h index e3c2789fc9..a7210931d9 100644 --- a/engine/src/flutter/impeller/compiler/compiler_backend.h +++ b/engine/src/flutter/impeller/compiler/compiler_backend.h @@ -9,8 +9,8 @@ #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" -#include "third_party/spirv_cross/spirv_glsl.hpp" -#include "third_party/spirv_cross/spirv_msl.hpp" +#include "spirv_glsl.hpp" +#include "spirv_msl.hpp" namespace impeller { namespace compiler { diff --git a/engine/src/flutter/impeller/compiler/reflector.h b/engine/src/flutter/impeller/compiler/reflector.h index 895ad996ee..5a5be69503 100644 --- a/engine/src/flutter/impeller/compiler/reflector.h +++ b/engine/src/flutter/impeller/compiler/reflector.h @@ -12,8 +12,8 @@ #include "impeller/compiler/compiler_backend.h" #include "impeller/compiler/runtime_stage_data.h" #include "inja/inja.hpp" -#include "third_party/spirv_cross/spirv_msl.hpp" -#include "third_party/spirv_cross/spirv_parser.hpp" +#include "spirv_msl.hpp" +#include "spirv_parser.hpp" namespace impeller { namespace compiler { diff --git a/engine/src/flutter/impeller/compiler/runtime_stage_data.h b/engine/src/flutter/impeller/compiler/runtime_stage_data.h index 405f99a64f..056a5ef8ed 100644 --- a/engine/src/flutter/impeller/compiler/runtime_stage_data.h +++ b/engine/src/flutter/impeller/compiler/runtime_stage_data.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" #include "impeller/compiler/types.h" -#include "third_party/spirv_cross/spirv_parser.hpp" +#include "spirv_parser.hpp" namespace impeller { namespace compiler { diff --git a/engine/src/flutter/impeller/compiler/types.h b/engine/src/flutter/impeller/compiler/types.h index f25589bdc1..3df651f4ac 100644 --- a/engine/src/flutter/impeller/compiler/types.h +++ b/engine/src/flutter/impeller/compiler/types.h @@ -10,8 +10,8 @@ #include "flutter/fml/macros.h" #include "shaderc/shaderc.hpp" -#include "third_party/spirv_cross/spirv_cross.hpp" -#include "third_party/spirv_cross/spirv_msl.hpp" +#include "spirv_cross.hpp" +#include "spirv_msl.hpp" namespace impeller { namespace compiler { diff --git a/engine/src/flutter/impeller/renderer/backend/gles/BUILD.gn b/engine/src/flutter/impeller/renderer/backend/gles/BUILD.gn index 505cbaa3ed..85f0a377bf 100644 --- a/engine/src/flutter/impeller/renderer/backend/gles/BUILD.gn +++ b/engine/src/flutter/impeller/renderer/backend/gles/BUILD.gn @@ -57,7 +57,7 @@ impeller_component("gles") { "texture_gles.h", ] - if (!is_android) { + if (!is_android && !is_fuchsia) { public_configs = [ ":gles_config" ] sources += [ "//third_party/angle/include/GLES2/gl2.h", diff --git a/engine/src/flutter/lib/spirv/test/BUILD.gn b/engine/src/flutter/lib/spirv/test/BUILD.gn index 421e1fd6ab..522392c2f1 100644 --- a/engine/src/flutter/lib/spirv/test/BUILD.gn +++ b/engine/src/flutter/lib/spirv/test/BUILD.gn @@ -6,13 +6,16 @@ import("//flutter/testing/testing.gni") if (enable_unittests) { executable("spirv_assembler") { + include_dirs = [ "//third_party/vulkan-deps/spirv-tools/src/include/" ] + sources = [ "spirv_assembler.cc" ] - configs += [ "//third_party/swiftshader_flutter:spvtools_public_config" ] + configs += + [ "//third_party/vulkan-deps/spirv-tools/src:spvtools_public_config" ] deps = [ - "//third_party/swiftshader_flutter:spvtools", - "//third_party/swiftshader_flutter:spvtools_val", + "//third_party/vulkan-deps/spirv-tools/src:spvtools", + "//third_party/vulkan-deps/spirv-tools/src:spvtools_val", ] } } diff --git a/engine/src/flutter/lib/spirv/test/spirv_assembler.cc b/engine/src/flutter/lib/spirv/test/spirv_assembler.cc index e6a11c9c6b..da51aca19f 100644 --- a/engine/src/flutter/lib/spirv/test/spirv_assembler.cc +++ b/engine/src/flutter/lib/spirv/test/spirv_assembler.cc @@ -8,7 +8,7 @@ #include #include -#include "third_party/swiftshader/third_party/SPIRV-Tools/include/spirv-tools/libspirv.hpp" +#include "spirv-tools/libspirv.hpp" namespace fs = std::filesystem; diff --git a/engine/src/flutter/shell/common/BUILD.gn b/engine/src/flutter/shell/common/BUILD.gn index bda5dd56e9..22bde213f9 100644 --- a/engine/src/flutter/shell/common/BUILD.gn +++ b/engine/src/flutter/shell/common/BUILD.gn @@ -302,9 +302,9 @@ if (enable_unittests) { # TODO(63837): This test is hard-coded to use a TestGLSurface so it cannot run on fuchsia. sources += [ "shell_io_manager_unittests.cc" ] - # Swiftshader only supports x86/64. Only needed on non-Fuchsia platforms. - if (shell_enable_vulkan && (target_cpu == "x86" || target_cpu == "x64")) { - deps += [ "//third_party/swiftshader_flutter:swiftshader_vulkan" ] + # Swiftshader only needed on non-Fuchsia platforms. + if (shell_enable_vulkan) { + deps += [ "//third_party/swiftshader" ] } } } diff --git a/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc b/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc index b63d41b085..51b7b87357 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_vulkan.cc @@ -8,7 +8,7 @@ #include "fml/trace_event.h" #include "include/core/SkColorSpace.h" #include "include/core/SkSize.h" -#include "third_party/swiftshader/include/vulkan/vulkan_core.h" +#include "vulkan/vulkan_core.h" namespace flutter { diff --git a/engine/src/flutter/shell/platform/embedder/BUILD.gn b/engine/src/flutter/shell/platform/embedder/BUILD.gn index 45e2d148fc..2b6459ef37 100644 --- a/engine/src/flutter/shell/platform/embedder/BUILD.gn +++ b/engine/src/flutter/shell/platform/embedder/BUILD.gn @@ -244,7 +244,10 @@ if (enable_unittests) { "tests/embedder_unittests_gl.cc", ] - deps += [ "//flutter/testing:opengl" ] + deps += [ + "//flutter/testing:opengl", + "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers", + ] } if (test_enable_metal) { diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/dpr_noxform.png b/engine/src/flutter/shell/platform/embedder/fixtures/dpr_noxform.png index 092591aae5..9fca30cca1 100644 Binary files a/engine/src/flutter/shell/platform/embedder/fixtures/dpr_noxform.png and b/engine/src/flutter/shell/platform/embedder/fixtures/dpr_noxform.png differ diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/dpr_xform.png b/engine/src/flutter/shell/platform/embedder/fixtures/dpr_xform.png index 3c6928c2c1..823f217aed 100644 Binary files a/engine/src/flutter/shell/platform/embedder/fixtures/dpr_xform.png and b/engine/src/flutter/shell/platform/embedder/fixtures/dpr_xform.png differ diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/gradient.png b/engine/src/flutter/shell/platform/embedder/fixtures/gradient.png index 27b69ecbb8..f2f75f1136 100644 Binary files a/engine/src/flutter/shell/platform/embedder/fixtures/gradient.png and b/engine/src/flutter/shell/platform/embedder/fixtures/gradient.png differ diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/gradient_xform.png b/engine/src/flutter/shell/platform/embedder/fixtures/gradient_xform.png index 186b98e87e..f9ea3ad539 100644 Binary files a/engine/src/flutter/shell/platform/embedder/fixtures/gradient_xform.png and b/engine/src/flutter/shell/platform/embedder/fixtures/gradient_xform.png differ 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 d152283677..ae7e32f1cc 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,7 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "tests/embedder_test_context.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/swiftshader/include/vulkan/vulkan_core.h" +#include "vulkan/vulkan_core.h" #ifdef SHELL_ENABLE_GL #include "flutter/shell/platform/embedder/tests/embedder_test_compositor_gl.h" diff --git a/engine/src/flutter/testing/BUILD.gn b/engine/src/flutter/testing/BUILD.gn index 25e6f7ab2e..3416c67d2c 100644 --- a/engine/src/flutter/testing/BUILD.gn +++ b/engine/src/flutter/testing/BUILD.gn @@ -146,10 +146,9 @@ if (enable_unittests) { "//flutter/vulkan", ] - # SwiftShader only supports x86/x86_64 - if (target_cpu == "x86" || target_cpu == "x64") { - configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ] - deps += [ "//third_party/swiftshader_flutter:swiftshader_vulkan" ] + if (!is_fuchsia) { + deps += [ "//third_party/swiftshader" ] + configs += [ "//third_party/swiftshader:swiftshader_config" ] } } @@ -215,10 +214,8 @@ if (is_mac || is_ios) { } } -# We only use SwiftShader on unittests and -# SwiftShader only supports x86/x86_64 -use_swiftshader = - enable_unittests && (target_cpu == "x86" || target_cpu == "x64") +# We only use SwiftShader on unittests +use_swiftshader = enable_unittests && !is_fuchsia source_set("opengl") { testonly = true @@ -234,7 +231,16 @@ source_set("opengl") { ] if (use_swiftshader) { - configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ] - deps += [ "//third_party/swiftshader_flutter:swiftshader_gl" ] + configs -= [ "//build/config/clang:extra_warnings" ] + configs += [ + "//flutter/vulkan:vulkan_config", # for swiftshader + "//third_party/angle:gl_prototypes", + "//third_party/swiftshader:swiftshader_config", + ] + deps += [ + "//third_party/angle:libEGL_static", + "//third_party/angle:libGLESv2_static", + "//third_party/swiftshader", + ] } } diff --git a/engine/src/flutter/testing/lsan_suppressions.txt b/engine/src/flutter/testing/lsan_suppressions.txt index 03eda3d326..d6891ae3cf 100644 --- a/engine/src/flutter/testing/lsan_suppressions.txt +++ b/engine/src/flutter/testing/lsan_suppressions.txt @@ -63,3 +63,8 @@ leak:fl_message_codec_decode_message # At the time of writing, this only amounts to 4 allocations totaling 512 bytes # worth of leaks. leak:g_realloc + + +# ANGLE's egl impelementation uses annotations that our LSAN setup does +# not respect. Ignore leaks from egl::* +leak:egl::* diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index 607a0bea65..c87b2f579d 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -10,6 +10,7 @@ A top level harness to run all unit-tests in a specific engine build. import argparse import glob +import errno import multiprocessing import os import re @@ -182,10 +183,20 @@ def RunEngineExecutable( unstripped_exe = os.path.join(build_dir, 'exe.unstripped', executable_name) env = os.environ.copy() - # We cannot run the unstripped binaries directly when coverage is enabled. - if IsLinux() and os.path.exists(unstripped_exe) and not coverage: - # Some tests depend on the EGL/GLES libraries placed in the build directory. - env['LD_LIBRARY_PATH'] = os.path.join(build_dir, 'lib.unstripped') + if IsLinux(): + env['LD_LIBRARY_PATH'] = build_dir + env['VK_DRIVER_FILES'] = os.path.join(build_dir, 'vk_swiftshader_icd.json') + if os.path.exists(unstripped_exe): + try: + os.symlink( + os.path.join(build_dir, 'lib.unstripped', 'libvulkan.so.1'), + os.path.join(build_dir, 'exe.unstripped', 'libvulkan.so.1') + ) + except OSError as e: + if e.errno == errno.EEXIST: + pass + else: + raise elif IsMac(): env['DYLD_LIBRARY_PATH'] = build_dir else: @@ -879,7 +890,7 @@ def RunEngineTasksInParallel(tasks): if len(failures) > 0: print("The following commands failed:") for task, exn in failures: - print("%s\n" % str(task)) + print("%s\n%s\n" % (str(task), str(exn))) raise Exception() @@ -1000,7 +1011,7 @@ def main(): ] process = subprocess.Popen(command, stdout=subprocess.PIPE) for line in process.stdout: - key, _, value = line.decode('ascii').strip().partition("=") + key, _, value = line.decode('utf8').strip().partition("=") os.environ[key] = value process.communicate() # Avoid pipe deadlock while waiting for termination. diff --git a/engine/src/flutter/testing/sanitizer_suppressions.sh b/engine/src/flutter/testing/sanitizer_suppressions.sh index 1da0c1b636..ec5c4bce6b 100755 --- a/engine/src/flutter/testing/sanitizer_suppressions.sh +++ b/engine/src/flutter/testing/sanitizer_suppressions.sh @@ -22,5 +22,5 @@ UBSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/ubsan_suppressions.txt" export UBSAN_OPTIONS="suppressions=${UBSAN_SUPPRESSIONS_FILE}" echo "Using Undefined Behavior suppressions in ${UBSAN_SUPPRESSIONS_FILE}" -export ASAN_OPTIONS="symbolize=1:detect_leaks=1" +export ASAN_OPTIONS="symbolize=1:detect_leaks=1:intercept_tls_get_addr=0" export ASAN_SYMBOLIZER_PATH="${BUILDTOOLS_DIRECTORY}/clang/bin/llvm-symbolizer" diff --git a/engine/src/flutter/testing/test_gl_surface.cc b/engine/src/flutter/testing/test_gl_surface.cc index 8c240b3596..6a3cc4d4bb 100644 --- a/engine/src/flutter/testing/test_gl_surface.cc +++ b/engine/src/flutter/testing/test_gl_surface.cc @@ -5,6 +5,8 @@ #include "flutter/testing/test_gl_surface.h" #include +#include +#include #include #include @@ -81,12 +83,54 @@ static std::string GetEGLError() { return stream.str(); } +static bool HasExtension(const char* extensions, const char* name) { + const char* r = strstr(extensions, name); + auto len = strlen(name); + // check that the extension name is terminated by space or null terminator + return r != nullptr && (r[len] == ' ' || r[len] == 0); +} + +static void CheckSwanglekExtensions() { + const char* extensions = ::eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + FML_CHECK(HasExtension(extensions, "EGL_EXT_platform_base")) << extensions; + FML_CHECK(HasExtension(extensions, "EGL_ANGLE_platform_angle_vulkan")) + << extensions; + FML_CHECK(HasExtension(extensions, + "EGL_ANGLE_platform_angle_device_type_swiftshader")) + << extensions; +} + +static EGLDisplay CreateSwangleDisplay() { + CheckSwanglekExtensions(); + + PFNEGLGETPLATFORMDISPLAYEXTPROC egl_get_platform_display_EXT = + reinterpret_cast( + eglGetProcAddress("eglGetPlatformDisplayEXT")); + FML_CHECK(egl_get_platform_display_EXT) + << "eglGetPlatformDisplayEXT not available."; + + const EGLint display_config[] = { + EGL_PLATFORM_ANGLE_TYPE_ANGLE, + EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE, + EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, + EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE, + EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE, + EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE, + EGL_NONE, + }; + + return egl_get_platform_display_EXT( + EGL_PLATFORM_ANGLE_ANGLE, + reinterpret_cast(EGL_DEFAULT_DISPLAY), + display_config); +} + TestGLSurface::TestGLSurface(SkISize surface_size) : surface_size_(surface_size) { - display_ = ::eglGetDisplay(EGL_DEFAULT_DISPLAY); + display_ = CreateSwangleDisplay(); FML_CHECK(display_ != EGL_NO_DISPLAY); - auto result = ::eglInitialize(display_, NULL, NULL); + auto result = ::eglInitialize(display_, nullptr, nullptr); FML_CHECK(result == EGL_TRUE) << GetEGLError(); EGLConfig config = {0}; diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index 0854928a97..84bbf4a614 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -426,19 +426,14 @@ def to_gn_args(args): # features can't work on these platforms. if args.target_os not in ['android', 'ios', 'wasm']: gn_args['skia_use_vulkan'] = True + gn_args['skia_vulkan_memory_allocator_dir' + ] = '//third_party/vulkan_memory_allocator' gn_args['shell_enable_vulkan'] = True # Disable VMA's use of std::shared_mutex in environments where the # standard library doesn't support it. if args.target_os == 'ios' or sys.platform.startswith(('cygwin', 'win')): gn_args['skia_disable_vma_stl_shared_mutex'] = True - if sys.platform.startswith(('cygwin', 'win')): - # The buildroot currently isn't set up to support Vulkan in the - # Windows ANGLE build, so disable it regardless of enable_vulkan's value. - gn_args['angle_enable_vulkan'] = False - # Don't build unnecessary portions of the ANGLE tree. - gn_args['angle_build_all'] = False - # We should not need a special case for x86, but this seems to introduce text relocations # even with -fPIC everywhere. # gn_args['enable_profiling'] = args.runtime_mode != 'release' and args.android_cpu != 'x86' @@ -535,6 +530,18 @@ def to_gn_args(args): if args.prebuilt_impellerc is not None: gn_args['impeller_use_prebuilt_impellerc'] = args.prebuilt_impellerc + # Do not build unnecessary parts of the ANGLE tree. + gn_args['angle_build_all'] = False + # Requires RTTI. We may want to build this in debug modes, punting on that + # for now. + gn_args['angle_enable_vulkan_validation_layers'] = False + gn_args['angle_vulkan_headers_dir' + ] = '//third_party/vulkan-deps/vulkan-headers/src' + gn_args['angle_vulkan_loader_dir' + ] = '//third_party/vulkan-deps/vulkan-loader/src' + gn_args['angle_vulkan_tools_dir' + ] = '//third_party/vulkan-deps/vulkan-tools/src' + return gn_args diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index 3961bfb159..7777e08c27 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -1887,6 +1887,47 @@ class _RepositoryWuffsDirectory extends _RepositoryDirectory { } } +class _RepositoryVulkanDepsDirectory extends _RepositoryDirectory { + _RepositoryVulkanDepsDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name != '.git' // source control + && entry.name != 'glslang' // only used on hosts for tests + && entry.name != 'spirv-cross' // Used by impellerc with separate license and host tests. See //flutter/impeller/compiler:impellerc_license + && entry.name != 'spirv-headers' // only used on hosts for tests + && entry.name != 'spirv-tools' // only used on hosts for tests + && entry.name != 'vulkan-loader' // on hosts for tests + && entry.name != 'vulkan-tools' // on hosts for tests + && entry.name != 'vulkan-validation-layers'; // on hosts for tests + } + + @override + _RepositoryDirectory createSubdirectory(fs.Directory entry) { + if (entry.name == 'vulkan-headers') { + return _RepositoryVulkanDepsSubDirectory(this, entry); + } + return super.createSubdirectory(entry); + } +} + +class _RepositoryVulkanDepsSubDirectory extends _RepositoryDirectory { + _RepositoryVulkanDepsSubDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name == 'src'; + } + + @override + _RepositoryDirectory createSubdirectory(fs.Directory entry) { + if (entry.name == 'src') { + return _RepositoryVulkanDirectory(this, entry); + } + return super.createSubdirectory(entry); + } +} + class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { _RepositoryRootThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @@ -1917,10 +1958,6 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir && entry.name != 'fontconfig' // not used in standard configurations && entry.name != 'swiftshader' // only used on hosts for tests && entry.name != 'shaderc' // Used by impellerc with separate license and host tests. See //flutter/impeller/compiler:impellerc_license - && entry.name != 'glslang' // only used on hosts for tests - && entry.name != 'spirv_tools' // only used on hosts for tests - && entry.name != 'spirv_headers' // only used on hosts for tests - && entry.name != 'spirv_cross' // Used by impellerc with separate license and host tests. See //flutter/impeller/compiler:impellerc_license && entry.name != 'ocmock' // only used for tests && entry.name != 'java' // only used for Android builds && entry.name != 'inja' // Only used by impellerc, which ships a separate license. See //flutter/impeller/compiler:impellerc_license @@ -1941,8 +1978,10 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return _RepositoryDartDirectory(this, entry); if (entry.name == 'expat') return _RepositoryExpatDirectory(this, entry); - if (entry.name == 'externals') - return _RepositoryThirdPartyExternalsDirectory(this, entry); + if (entry.name == 'vulkan_memory_allocator') + return _RepositoryVulkanMemoryAllocatorDirectory(this, entry); + if (entry.name == 'vulkan-deps') + return _RepositoryVulkanDepsDirectory(this, entry); if (entry.name == 'freetype-android') throw '//third_party/freetype-android is no longer part of this client: remove it'; if (entry.name == 'freetype2') @@ -1990,18 +2029,6 @@ class _RepositoryThirdPartyWebDependenciesDirectory extends _RepositoryDirectory } } -/// Corresponds to the `src/third_party/externals` directory -class _RepositoryThirdPartyExternalsDirectory extends _RepositoryDirectory { - _RepositoryThirdPartyExternalsDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - _RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'vulkanmemoryallocator') - return _RepositoryVulkanMemoryAllocatorDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - class _RepositoryVulkanMemoryAllocatorDirectory extends _RepositoryDirectory { _RepositoryVulkanMemoryAllocatorDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); diff --git a/engine/src/flutter/vulkan/BUILD.gn b/engine/src/flutter/vulkan/BUILD.gn index 11ab1efc57..3992b361d3 100644 --- a/engine/src/flutter/vulkan/BUILD.gn +++ b/engine/src/flutter/vulkan/BUILD.gn @@ -5,13 +5,13 @@ import("//build/fuchsia/sdk.gni") config("vulkan_config") { - include_dirs = [] + include_dirs = [ "//third_party/vulkan_memory_allocator/include" ] defines = [ "VULKAN_HPP_NO_EXCEPTIONS=1" ] if (is_fuchsia) { include_dirs += [ "//third_party/fuchsia-vulkan/include" ] defines += [ "VK_USE_PLATFORM_FUCHSIA=1" ] } else { - include_dirs += [ "//third_party/vulkan-headers/include" ] + include_dirs += [ "//third_party/vulkan-deps/vulkan-headers/src/include" ] } } @@ -65,4 +65,7 @@ source_set("vulkan") { ":vulkan_config", "//flutter:config", ] + + public_deps = + [ "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers" ] }