-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: add a bench and render tests for tesselation #7894
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
Open
CommanderStorm
wants to merge
11
commits into
maplibre:main
Choose a base branch
from
CommanderStorm:tesselation-workup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
abfd660
add a bench and render tests
CommanderStorm 795f706
re-encode the tiles for a fair comparison
CommanderStorm 3a81a7c
Refactor comments in MLTParse class
CommanderStorm 07128fb
Merge branch 'main' into tesselation-workup
CommanderStorm fc1de50
Merge branch 'main' into tesselation-workup
CommanderStorm 233c568
use abstrac class
CommanderStorm d6ad29b
Merge branch 'main' into tesselation-workup
CommanderStorm 69c4777
Merge branch 'main' into tesselation-workup
CommanderStorm 8c17458
Merge branch 'main' into tesselation-workup
HarelM f691f94
Merge branch 'main' into tesselation-workup
CommanderStorm 446ddbb
Merge branch 'main' into tesselation-workup
CommanderStorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import Benchmark from '../lib/benchmark.ts'; | ||
| import TileParser from '../lib/tile_parser.ts'; | ||
| import {OverscaledTileID} from '../../../src/tile/tile_id.ts'; | ||
| import type {LayerSpecification, StyleSpecification} from '@maplibre/maplibre-gl-style-spec'; | ||
|
|
||
| type MLTParseOptions = { | ||
| /** | ||
| * Tile directory under `test/integration/assets/tiles`. | ||
| * `mlt` ships a pre-baked triangle mesh | ||
| * `mlt-untessellated` does not, forcing MapLibre to re-tessellate with earcut. | ||
| */ | ||
| tilesDir: 'mlt' | 'mlt-untessellated'; | ||
| tileID: OverscaledTileID; | ||
| /** Layers rendered on top of the shared MLT source. */ | ||
| layers: LayerSpecification[]; | ||
| }; | ||
|
|
||
| /** | ||
| * Isolates the worker-side cost of turning an MLT tile into renderable geometry. | ||
| * It drives {@link TileParser} so it covers decode + `loadGeometry` + bucket population + tessellation | ||
| */ | ||
| abstract class MLTParse extends Benchmark { | ||
| parser: TileParser; | ||
| tile: {tileID: OverscaledTileID; buffer: ArrayBuffer}; | ||
|
|
||
| abstract get options(): MLTParseOptions; | ||
|
|
||
| async setup(): Promise<void> { | ||
| const style: StyleSpecification = { | ||
| version: 8, | ||
| sources: { | ||
| openmaptiles: { | ||
| type: 'vector', | ||
| encoding: 'mlt', | ||
| maxzoom: 14, | ||
| tiles: [`/test/integration/assets/tiles/${this.options.tilesDir}/{z}/{x}/{y}.mlt`] | ||
| } as any | ||
| }, | ||
| layers: this.options.layers | ||
| }; | ||
|
|
||
| this.parser = new TileParser(style, 'openmaptiles'); | ||
| await this.parser.setup(); | ||
| this.tile = await this.parser.fetchTile(this.options.tileID); | ||
| // Warm up: run one parse so the benchmarked loop measures steady state. | ||
| await this.parser.parseTile(this.tile); | ||
| } | ||
|
|
||
| async bench(): Promise<void> { | ||
| await this.parser.parseTile(this.tile); | ||
| } | ||
| } | ||
|
|
||
| const fillLayers: LayerSpecification[] = [ | ||
| {id: 'landcover', type: 'fill', source: 'openmaptiles', 'source-layer': 'landcover', paint: {'fill-color': '#008000'}} | ||
| ]; | ||
| const fillExtrusionLayers: LayerSpecification[] = [ | ||
| {id: 'background', type: 'background', paint: {'background-color': '#ffffff'}}, | ||
| {id: 'building', type: 'fill-extrusion', source: 'openmaptiles', 'source-layer': 'building', paint: {'fill-extrusion-color': '#c86432', 'fill-extrusion-height': 20}} | ||
| ]; | ||
| const fillTileID = new OverscaledTileID(5, 0, 5, 22, 12); | ||
| const buildingTileID = new OverscaledTileID(14, 0, 14, 8716, 5685); | ||
|
|
||
| export class MLTFillTessellated extends MLTParse { | ||
| get options(): MLTParseOptions { | ||
| return {tilesDir: 'mlt', tileID: fillTileID, layers: fillLayers}; | ||
| } | ||
| } | ||
|
|
||
| export class MLTFillUntessellated extends MLTParse { | ||
| get options(): MLTParseOptions { | ||
| return {tilesDir: 'mlt-untessellated', tileID: fillTileID, layers: fillLayers}; | ||
| } | ||
| } | ||
|
|
||
| export class MLTFillExtrusionTessellated extends MLTParse { | ||
| get options(): MLTParseOptions { | ||
| return {tilesDir: 'mlt', tileID: buildingTileID, layers: fillExtrusionLayers}; | ||
| } | ||
| } | ||
|
|
||
| export class MLTFillExtrusionUntessellated extends MLTParse { | ||
| get options(): MLTParseOptions { | ||
| return {tilesDir: 'mlt-untessellated', tileID: buildingTileID, layers: fillExtrusionLayers}; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+28.4 KB
...er/tests/mlt/render-layers/render-building-extrusion-untessellated/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
...gration/render/tests/mlt/render-layers/render-building-extrusion-untessellated/style.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "version": 8, | ||
| "metadata": { | ||
| "test": { | ||
| "height": 256 | ||
| } | ||
| }, | ||
| "center": [ | ||
| 11.525101, | ||
| 48.144716 | ||
| ], | ||
| "zoom": 14.92, | ||
| "pitch": 55, | ||
| "bearing": -20, | ||
| "sources": { | ||
| "openmaptiles": { | ||
| "type": "vector", | ||
| "encoding": "mlt", | ||
| "tiles": ["local://tiles/mlt-untessellated/{z}/{x}/{y}.mlt"] | ||
| } | ||
| }, | ||
| "layers": [ | ||
| { | ||
| "id": "background", | ||
| "type": "background", | ||
| "paint": { | ||
| "background-color": "#ffffff" | ||
| } | ||
| }, | ||
| { | ||
| "id": "building", | ||
| "type": "fill-extrusion", | ||
| "source": "openmaptiles", | ||
| "source-layer": "building", | ||
| "paint": { | ||
| "fill-extrusion-color": "#c86432", | ||
| "fill-extrusion-height": 20 | ||
| } | ||
| } | ||
| ] | ||
| } |
Binary file added
BIN
+28.4 KB
...tegration/render/tests/mlt/render-layers/render-building-extrusion/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
test/integration/render/tests/mlt/render-layers/render-building-extrusion/style.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "version": 8, | ||
| "metadata": { | ||
| "test": { | ||
| "height": 256 | ||
| } | ||
| }, | ||
| "center": [ | ||
| 11.525101, | ||
| 48.144716 | ||
| ], | ||
| "zoom": 14.92, | ||
| "pitch": 55, | ||
| "bearing": -20, | ||
| "sources": { | ||
| "openmaptiles": { | ||
| "type": "vector", | ||
| "encoding": "mlt", | ||
| "tiles": ["local://tiles/mlt/{z}/{x}/{y}.mlt"] | ||
| } | ||
| }, | ||
| "layers": [ | ||
| { | ||
| "id": "background", | ||
| "type": "background", | ||
| "paint": { | ||
| "background-color": "#ffffff" | ||
| } | ||
| }, | ||
| { | ||
| "id": "building", | ||
| "type": "fill-extrusion", | ||
| "source": "openmaptiles", | ||
| "source-layer": "building", | ||
| "paint": { | ||
| "fill-extrusion-color": "#c86432", | ||
| "fill-extrusion-height": 20 | ||
| } | ||
| } | ||
| ] | ||
| } |
Binary file added
BIN
+22.5 KB
...tion/render/tests/mlt/render-layers/render-landcover-untessellated/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
test/integration/render/tests/mlt/render-layers/render-landcover-untessellated/style.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "version": 8, | ||
| "metadata": { | ||
| "test": { | ||
| "debug": true, | ||
| "height": 256 | ||
| } | ||
| }, | ||
| "center": [ | ||
| 73, | ||
| 36 | ||
| ], | ||
| "zoom": 5.99, | ||
| "sources": { | ||
| "openmaptiles": { | ||
| "type": "vector", | ||
| "encoding": "mlt", | ||
| "tiles": ["local://tiles/mlt-untessellated/{z}/{x}/{y}.mlt"], | ||
| "maxzoom": 14 | ||
| } | ||
| }, | ||
| "sprite": "local://sprites/sprite", | ||
| "layers": [ | ||
| { | ||
| "id": "landcover", | ||
| "type": "fill", | ||
| "source": "openmaptiles", | ||
| "source-layer": "landcover", | ||
| "paint": { | ||
| "fill-color": "#008000" | ||
| } | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to be reencoded using the rust encoder because otherwise they are very weird (early java enoder I guess) and also not a good benchmark in comparison to the smaller, tesselated tiles