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

Triangulated fill outlines #1780

Closed
wants to merge 70 commits into from

Conversation

stefankarschti
Copy link
Collaborator

@stefankarschti stefankarschti commented Oct 18, 2023

feat: Fill layer to generate outlines composed of triangle primitives

  • Created a new addition to the fill generator functions to generate this new fill+outline variant
  • The Fill bucket generates fill outlines with triangle primitives, compatible with the Line shader
  • The Fill bucket uses gfx::generateFillAndOutineBuffers to generate its buffers
  • Added an option to enable/disable this feature at compile time with the MLN_TRIANGULATE_FILL_OUTLINES #define in fill_bucket.hpp

Refs: #1768

@stefankarschti stefankarschti self-assigned this Oct 18, 2023
@stefankarschti
Copy link
Collaborator Author

WIP
image

@stefankarschti
Copy link
Collaborator Author

stefankarschti commented Oct 20, 2023

Comparison of fill outlines

Legacy renderer:
IMG_0032

Drawable renderer (width=2):
IMG_0031

Metal renderer (width=1):
IMG_0035-metalx1

@stefankarschti
Copy link
Collaborator Author

Fill pattern outline drawn with the legacy renderer:
IMG_0033-legacy

And with the Metal renderer (no outline):
IMG_0034-metal

@github-actions
Copy link

github-actions bot commented Oct 20, 2023

Bloaty Results 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5%  +749Ki  +0.4%  +128Ki    TOTAL

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

Compared to d387090 (legacy)

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +20% +22.8Mi  +404% +24.1Mi    TOTAL

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

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.

Why is the MLN_TRIANGULATE_FILL_OUTLINES flag needed? Is it only because the legacy renderer does not support it? In this case, please add a comment to the issue to remove the legacy renderer to remove this build flag as well.

In general, I think we should avoid build time configuration as much as possible because only the default is tested / compiled on CI.

@stefankarschti
Copy link
Collaborator Author

@louwers : I added that flag following Steve's recommendation to "provide an option to turn that off and use Metal lines"...
CC @sjg-wdw

@sjg-wdw
Copy link
Collaborator

sjg-wdw commented Nov 13, 2023

@louwers : I added that flag following Steve's recommendation to "provide an option to turn that off and use Metal lines"... CC @sjg-wdw

Nice!

@alexcristici
Copy link
Collaborator

alexcristici commented Nov 15, 2023

There are 13 render tests that are passing now with #define MLN_TRIANGULATE_FILL_OUTLINES 1. 👍

But render test render-tests/fill-outline-color/property-function is drawing white background, before it was drawing ok but failing because of line width.

Before:
After

After:
Before

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.

Should we make the more correct (less performant) version the default?

@sjg-wdw @stefankarschti Can one of you create an issue that links to this PR to re-address this after variants have been introduced?

@stefankarschti
Copy link
Collaborator Author

While investigating the failed render tests I realized that we also need shader variations for the triangulated lines in case of outline-color and opacity per-vertex, which is the case with some expressions.
render-tests/fill-outline-color/zoom-and-property-function
render-tests/fill-outline-color/property-function
ref #1855

@stefankarschti stefankarschti marked this pull request as draft November 16, 2023 20:10
@stefankarschti stefankarschti deleted the metal-fill-outline branch November 22, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants