Hasty Briefsbeta

Bilingual

One attribute to rule them all

14 hours ago
  • #Symbol Rendering
  • #Mapbox SDK
  • #GPU Optimization
  • The text discusses a significant technical overhaul in Mapbox SDKs for symbol rendering, addressing limitations in per-feature styling.
  • Previously, each data-driven paint property consumed a vertex attribute slot, leading to a hard ceiling of 16 slots in WebGL2, which limited styling flexibility and caused performance issues when updating properties at runtime.
  • The solution involved replacing multiple vertex attributes with a single feature index attribute, using Uniform Buffer Objects (UBOs) to store per-feature properties, reducing attribute slot usage regardless of the number of properties.
  • A three-buffer structure (header, properties, and block-indices buffers) was implemented, with a byte-for-byte identical layout across WebGL2, Metal, Vulkan, and OpenGL backends, ensuring consistency and simplifying maintenance.
  • This UBO infrastructure enabled 'Appearances,' allowing conditional style variants for features (e.g., selected POIs) without expensive vertex buffer re-uploads, by updating property blocks or indirection tables.
  • The approach provides scalability, allowing all nine data-driven paint properties in symbol layers within one attribute slot, and sets a foundation for future enhancements like layout property updates and animations.
  • Future extensions include applying the UBO model to all layer types, optimizing layout property changes, and supporting animations through the indirection layer, with the potential for representation-based indexing to further improve efficiency.