Skip to content

[Impeller] Wire up Angle with playgrounds on all platforms. #151353

Closed
flutter-team-archive/engine
#56328

Description

@chinmaygarde

Today, --use_angle only works on macOS with the playgrounds. And it happens to be the default on macOS anyway as the default driver is broken. This makes the value of this flag somewhat dubious.

When I tried to wire this up on Windows and Linux, I ran into issues with static linking of Angle with GLFW as GLFW doesn't seem to comprehend that Angle can be linked statically.

When I tried to setup Angle to be linked dynamically, Angle was sad when compiling the Vulkan adapter (which is not needed on macOS) because of the way Flutter compiles its own VMA. When compiling statically, Angle can use our VMA. But it misses those symbols when compiling dynamically.

Either GLFW should be patched to work with a statically linked Angle or we should figure out our rules on making Angle have access to a VMA when linking dynmaically.

My preference is for the latter.

Activity

  1. added
    P3Issues that are less important to the Flutter project
    on Jul 8, 2024
  2. gaaclarke commented on Nov 1, 2024

    @gaaclarke
    Member

    If you look through the GN files for angle there doesn't seem to be a place where it ever specifies VMA as a dependency. There is some references to what version they'd like to use and there is some references to the fact that Angle uses a fork of VMA in //doc/BranchingAndRolling.md Here's some example output I get when trying to link angle on linux:

    $ ./flutter/bin/et build -c host_debug_unopt //flutter/impeller/golden_tests:impeller_golden_tests
    [2024-11-01T21:32:52.305][linux/host_debug_unopt: GN]: OK
    [2024-11-01T21:32:53.482][linux/host_debug_unopt: RBE startup]: Proxy started successfully.
    [linux/host_debug_unopt: ninja] 33.3% (1/3) SOLINK ./libGLESv2.so[2024-11-01 21:32:55.976908][linux/host_debug_unopt: ninja]: FAILED
    COMMAND:
    /usr/local/google/home/aaclarke/dev/engine/src/flutter/third_party/ninja/ninja -C /usr/local/google/home/aaclarke/dev/engine/src/out/host_debug_unopt -j 320 flutter/impeller/golden_tests:impeller_golden_tests
    STDOUT:
    ninja: Entering directory `/usr/local/google/home/aaclarke/dev/engine/src/out/host_debug_unopt'
    FAILED: libGLESv2.so libGLESv2.so.TOC 
    ../../flutter/buildtools/linux-x64/clang/bin/clang++ -shared -Wl,--fatal-warnings -m64 -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -pthread -Wl,--undefined-version --sysroot=../../build/linux/debian_sid_amd64-sysroot   -o ./libGLESv2.so -Wl,--build-id=sha1 -Wl,-soname=libGLESv2.so @./libGLESv2.so.rsp && { ../../flutter/buildtools/linux-x64/clang/bin/llvm-readelf -d ./libGLESv2.so | grep SONAME ; ../../flutter/buildtools/linux-x64/clang/bin/llvm-nm -gD -f posix ./libGLESv2.so | cut -f1-2 -d' '; } > ./libGLESv2.so.tmp && if ! cmp -s ./libGLESv2.so.tmp ./libGLESv2.so.TOC; then mv ./libGLESv2.so.tmp ./libGLESv2.so.TOC; fi
    ld.lld: error: undefined symbol: vmaCreateAllocator
    >>> referenced by vk_mem_alloc_wrapper.cpp:76 (out/host_debug_unopt/../../flutter/third_party/angle/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp:76)
    >>>               obj/flutter/third_party/angle/src/libANGLE/renderer/vulkan/angle_vk_mem_alloc_wrapper.vk_mem_alloc_wrapper.o:(vma::InitAllocator(VkPhysicalDevice_T*, VkDevice_T*, VkInstance_T*, unsigned int, unsigned long, VmaAllocator_T**))
    
    ld.lld: error: undefined symbol: vmaDestroyAllocator
    >>> referenced by vk_mem_alloc_wrapper.cpp:81 (out/host_debug_unopt/../../flutter/third_party/angle/src/libANGLE/renderer/vulkan/vk_mem_alloc_wrapper.cpp:81)
    >>>               obj/flutter/third_party/angle/src/libANGLE/renderer/vulkan/angle_vk_mem_alloc_wrapper.vk_mem_alloc_wrapper.o:(vma::DestroyAllocator(VmaAllocator_T*))
    

    We have the VMA at //third_party/vulkan_memory_allocator. We need to somehow shoehorn that dependency into the angle target.

  3. gaaclarke commented on Nov 1, 2024

    @gaaclarke
    Member

    Okay, I think I know what's going on. VMA is kind of a weird library, you have to declare VMA_IMPLEMENTATION and include the header in one cc file (https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/quick_start.html). We are setting up the angle_vulkan_memory_allocator_dir but that is just point to the vulkan_memory_allocator directory, which doesn't have a cc file that does the VMA_IMPLEMENTATION trick. We need to make a separate directory that will do that trick then point angle_vulkan_memory_allocator_dir there.

  4. gaaclarke commented on Nov 4, 2024

    @gaaclarke
    Member

    I'm going to reopen this. This fixes the problem described in the description but doesn't make it so you can run opengles playgrounds on linux. I think that should be the outcome of this.

  5. gaaclarke commented on Nov 4, 2024

    @gaaclarke
    Member

    oh, wait, this actually works now, closing it
    Screenshot 2024-11-04 at 2 27 07 PM

  6. github-actions commented on Nov 18, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecte: impellerImpeller rendering backend issues and features requestse: openglteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions