phase(N.5b) Task 6: TerrainModernRenderer

The new terrain dispatcher. Single global VBO/EBO with a slot
allocator (one slot per landblock, 384 verts × 40 bytes per slot).
Per-frame: build DEIC array from visible slots, upload, dispatch
via glMultiDrawElementsIndirect. Atlas textures bound via bindless
handles set per-frame as sampler uniforms.

Total ~6-8 GL calls per frame for terrain regardless of visible
landblock count (vs today's per-LB binds at radius=2 → ~25 calls,
radius=5 → ~121 calls).

API mirrors TerrainChunkRenderer so GameWindow integration in T8 is
a drop-in field+ctor swap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-09 09:05:28 +02:00
parent 4ed79207a6
commit 0a77bd1fd7
2 changed files with 353 additions and 0 deletions

View file

@ -45,6 +45,15 @@ public sealed class BindlessSupport
_ext.MakeTextureHandleNonResident(handle);
}
/// <summary>
/// Set a sampler-typed uniform from a 64-bit bindless handle. Uses
/// glProgramUniformHandleARB so it doesn't require the program to be bound.
/// </summary>
public void SetSamplerHandleUniform(uint program, int location, ulong handle)
{
_ext.ProgramUniformHandle(program, location, handle);
}
/// <summary>Detect <c>GL_ARB_shader_draw_parameters</c> in addition to bindless.
/// N.5's vertex shader uses <c>gl_BaseInstanceARB</c> and <c>gl_DrawIDARB</c>
/// from this extension.</summary>