render3d: grass in chunks of 256 tiles a draw, flower casters only into the cascades they reach
Grass (Vulkan with multi-draw indirect): every visible tile is a record in one buffer, uploaded once a frame, and each band draws its records 256 at a time. A record's firstInstance is its place in the chunk times 65536; grass.vert's TILES variant reads that place's corner and indices per cell from u_tiles. R3D_GRASS_TILES=1 keeps a draw per tile. OpenGL is unchanged. Casters: a LOD level with no impostor is drawn into a shadow cascade only when its distance band, widened by six times its height, the camera's height over the ground and the frustum's corner reach, can touch that cascade's receivers. The flowers' mesh levels (6 - 30 m) leave the three outer cascades. R3D_CAST_ALL=1 draws every level everywhere. OpenGL frames byte-identical at all five viewpoints; alpha-tested shadow draws at a 460 -> 244. gpu_has_mdi() guards both this and the GPU-culled trees' multi-record draws. Camp: Mac Vulkan 2645 -> 2191 (grass) -> 2034 draws; PC 2657 -> 2046, self-tests 59/59, validation 0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d8300a7bf9
commit
cdfffa62bb
9 changed files with 202 additions and 9 deletions
|
|
@ -516,6 +516,8 @@ function gpu_buffer_free(buf: int) -> void {
|
|||
# a caller keeps its CPU path. A compute program's binding 0 is its parameter block (params,
|
||||
# copied at the dispatch); bindings 1.. are `bufs`, gpu buffers.
|
||||
function gpu_has_compute() -> bool { return gpu_kind == GPU_VK }
|
||||
# several records in one indirect draw, each with its own firstInstance
|
||||
function gpu_has_mdi() -> bool { return gpu_kind == GPU_VK and gvk_has_mdi }
|
||||
function gpu_compute(name: string, n_bufs: int) -> int {
|
||||
if gpu_kind != GPU_VK { return 0 }
|
||||
return gvk_compute_new(name, n_bufs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue