Files
horizon-airdef/crates
Ludovic Marie 7384db307d Block textures: share identical sprites, and draw past 2048 layers
Every block sprite is a layer of one texture array, and GPUs give an array
at most 2048 layers (Metal, most Vulkan drivers). Vanilla takes 1250; eight
real NeoForge mods carried over (docs/modpacks.md) take 2183, and the game
stopped at start with "GPU supports 2048 texture layers; 2200 required".

- Sprites: a still texture with the same pixels and mip settings as one
  already loaded reuses its layer (mods copy vanilla's textures under their
  own names): 17 layers fewer for those mods, none for vanilla.
- The renderer splits the layers over up to four arrays of 2048 (8192
  sprites). terrain.wgsl picks the array per fragment with derivatives taken
  in uniform control flow; a pipeline constant keeps vanilla, which needs one
  array, on the same single textureSample as before.
- HORIZON_SPRITE_SPLIT (dev only) forces a smaller split: vanilla drawn from
  three arrays of 512 renders the same blocks as from one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 01:10:35 +02:00
..