Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan renderer backend #2564

Merged
merged 48 commits into from
Aug 1, 2024
Merged

Conversation

adrian-cojocaru
Copy link
Collaborator

@adrian-cojocaru adrian-cojocaru commented Jun 28, 2024

Rough implementation of a Vulkan renderer backend (tested on Windows).

image

Notes:

  • Vulkan 1.0
  • validation layers are populated from the environment (VulkanSDK, vkconfig, etc)
  • Vulkan-Headers C++ bindings with dynamic function loader
  • VulkanMemoryAllocator
  • runtime shader compilation using glslang
  • vsync is forcefully enabled
  • requires a valid surface (no offscreen rendering at the moment)
  • a common pipeline layout is used for compatibility
  • one command buffer submitted per frame

List of working shaders (and associated functionality):

  • BackgroundShader
  • BackgroundPatternShader
  • CircleShader
  • ClippingMaskProgram
  • CollisionBoxShader
  • CollisionCircleShader
  • CustomSymbolIconShader
  • DebugShader
  • FillShader
  • FillOutlineShader
  • FillPatternShader
  • FillOutlinePatternShader
  • FillOutlineTriangulatedShader
  • FillExtrusionShader
  • FillExtrusionPatternShader
  • HeatmapShader
  • HeatmapTextureShader
  • HillshadeShader
  • HillshadePrepareShader
  • LineShader
  • LineGradientShader
  • LineSDFShader
  • LinePatternShader
  • RasterShader
  • SymbolIconShader
  • SymbolSDFIconShader
  • SymbolTextAndIconShader
  • WideVectorShader

Copy link

github-actions bot commented Jun 28, 2024

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +1.27Ki  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2564-compared-to-main.txt

Copy link

github-actions bot commented Jun 28, 2024

Bloaty Results 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +20.7Ki  +0.0% +3.88Ki    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2564-compared-to-main.txt

Compared to d387090 (legacy)

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +21% +24.7Mi  +411% +24.6Mi    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2564-compared-to-legacy.txt

Copy link

github-actions bot commented Jun 28, 2024

Benchmark Results ⚡

Benchmark                                                     Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------
OVERALL_GEOMEAN                                            +0.0019         +0.0017             0             0             0             0

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-2564-compared-to-main.txt

@louwers
Copy link
Collaborator

louwers commented Jul 12, 2024

As discussed, let's not add any tests to CI yet for the Vulkan backend, but make sure it builds for Linux on CI.

@adrian-cojocaru If you can share some build instructions I am happy to add it to linux-ci.yml.

Copy link
Collaborator

@louwers louwers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy we got a build going on CI!

There's not a lot I can comment on except for C++ nitpicking. Left some comments but there's not really any blockers in that regard from my side.

@adrian-cojocaru adrian-cojocaru merged commit 072aa32 into maplibre:main Aug 1, 2024
38 checks passed
@adrian-cojocaru adrian-cojocaru deleted the vulkan-backend branch August 2, 2024 09:51
@jwinarske
Copy link
Contributor

I am able to build and run mbgl-glfw built with clang 10 as well as GCC 9.4 with attached patch.

Lots of clang-tidy issues; some are directly related to the compiler errors.

Build flags:

-DMLN_WITH_VULKAN=ON
-DMLN_WITH_X11=OFF
-DMLN_WITH_WAYLAND=OFF
-DMLN_DRAWABLE_RENDERER=ON
-DMLN_LEGACY_RENDERER=OFF
-DMLN_WITH_VULKAN=ON
-DMLN_WITH_OPENGL=OFF
-DMLN_WITH_EGL=OFF

0001-Changes-to-build-GCC-9.4-Clang-10.zip

@louwers
Copy link
Collaborator

louwers commented Aug 2, 2024

@jwinarske Could you share your clang-tidy config? Here is ours: https://github.com/maplibre/maplibre-native/blob/main/.clang-tidy

Any chance you could upstream your patch as a PR?

@adrian-cojocaru
Copy link
Collaborator Author

@jwinarske Seems to compile without any issue on clang 10/GCC 9.4. As @louwers suggested the difference is probably in clang-tidy config.

Copy link
Member

@birkskyum birkskyum Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can/will this also be used for validating the opengl GLSL shaders, or is it only relevant for vulkan/SPIR-V?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be used for validation/reflection but it's relevant only for Vulkan at the moment. Ideally even there it should end up as a build time step to avoid linking.

@birkskyum birkskyum mentioned this pull request Aug 3, 2024
bilal614 pushed a commit to bilal614/maplibre-native that referenced this pull request Aug 5, 2024
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants