perf(render): tessellate a GPU scene's layers on several threads
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- backend, performance
Direzione di ricerca
Start by reading the GPU branch in crates/render/src/lib.rs, then inspect mesh::collect_layer in crates/render/src/mesh.rs and the threaded mesh building in tile_mesh.rs. Check AGENTS.md for the threading guidance and use the vector_layers_bench command in the issue to establish the GPU baseline. Done means the one-thread and multi-thread scenes match, the vertex-room fallback matches, and the GPU benchmark sequences improve.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With the GPU backend on (the status bar's CPU/GPU switch, or RUSTGIS_GPU), each full redraw tessellates every layer's geometry into meshes on one thread. Zoomed out, that makes a GPU redraw slower than drawing the frame on the CPU.
Measured
vector_layers_bench (#2525, with BENCH_BACKEND=gpu, #2539) on swisstopo's swiss-map-vector25, one map sheet (66 layers, 335,000 features, 3.0 million vertices). This is the CPU side of a GPU frame (the scene render_backend(.., Backend::Gpu) builds), not the device's upload and draw. Median frame, one build, CPU backend drawing in bands on 16 threads:
| Sequence | CPU 1× | GPU 1× | CPU 2× | GPU 2× |
|---|---|---|---|---|
| whole sheet | 336 ms | 322 ms | 828 ms | 613 ms |
| zoom | 166 ms | 250 ms | 293 ms | 278 ms |
| pan 10 m | 120 ms | 211 ms | 293 ms | 283 ms |
| pan 3 m | 54 ms | 38 ms | 158 ms | 49 ms |
The GPU wins zoomed in and at 2×: its cost doesn't grow with the pixels. Zoomed out at 1× it is up to 75% slower. A zoomed-out scene holds 3.2–4.9 million vertices (about 130–195 MB at 40 bytes a vertex).
While the map moves, the app moves the last scene's meshes without building anything (the camera fast path). These numbers are the redraw when it stops, or when the view leaves the meshes' reach.
Where
render_frame's GPU branch (crates/render/src/lib.rs, mesh::collect_layer for each layer) and crates/render/src/mesh.rs. Each layer's tessellation is independent of the others. Vector tiles already build their meshes on several threads (tile_mesh.rs).
Proposal
Tessellate the layers, or a big layer's features in chunks, on rustgis_data::threads::max() threads (AGENTS.md "Use the threads"):
- the same scene as one thread, command for command, in layer order;
- the layer's vertex room (
MAX_LAYER_VERTICES) decided as one thread decides it; - one thread below a size threshold and in the browser;
- scratch within
memory::thread_scratch; - a thread the system refuses costs speed only.
The CPU parts of the scene (layers drawn as pictures) stay where they are in the order.
Keeping a layer's meshes between redraws is #1057's step 2.4, and goes with it.
Tests
- A scene built on 1 and several threads is the same.
- A layer over its vertex room falls back as on one thread.
- The benchmark's GPU sequences before and after.
Related
- The benchmark's GPU option is merged (#2539):
BENCH_BACKEND=gpu cargo run --release -p rustgis-render --example vector_layers_bench -- map.gpkg. - #2540's second step decides before tessellating whether a layer is worth a mesh (features in view and their size on screen) instead of after
MAX_LAYER_VERTICESis reached. That takes the biggest zoomed-out layers out of tessellation altogether, so it comes before this and changes what is left to split; measure again after it. - Keeping a layer's meshes between redraws is #1057's step 2.4 (measurements posted there).
- Lingua principale
- Rust
- Stelle
- 1.9k
- Fork
- 268
- Merge medio
- 11h 1m
- PR unite (30g)
- 942
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opengeos/RustGIS
-
[Bug]: layer.move to the place a layer already has fails and stops a script; with several layers it leaves an empty undo stepForse già presa @jgregoriorincon l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opengeos/RustGIS#2621 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
opengeos/RustGIS#1446 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di opengeos/RustGIS
Issue simili
-
文件夹重大BUG:不支持重命名Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
postgresql-rules / queue-rules: implicit KEY SHARE before a parent key update, and job self-overlapAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
jonathanong/no-mistakes#3879 ·
I maintainer di solito rispondono entro 1 giorno
-
area:index v0.35.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pbakaus/impeccable#1653 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
nautechsystems/nautilus_trader#5741 ·
I maintainer di solito rispondono entro 1 giorno