phase(N.5) Task 10: glMultiDrawElementsIndirect dispatch — visual verified
Replaces WbDrawDispatcher's per-group glDrawElementsInstancedBaseVertexBaseInstance loop with two glMultiDrawElementsIndirect calls (opaque + transparent). Per-frame uploads three SSBOs: - _instanceSsbo @ binding=0 (mat4 per instance, indexed by gl_BaseInstanceARB + gl_InstanceID) - _batchSsbo @ binding=1 (BatchData per group, indexed by gl_DrawIDARB) - _indirectBuffer (DrawElementsIndirectCommand[] — opaque first, transparent second) GameWindow swaps the shader load to mesh_modern when _bindlessSupport is non-null. Capability detection + shader load now run in the right order (capability before TextureCache + before Shader). Deletes the obsolete DrawGroup stub, EnsureInstanceAttribs, _instanceBuffer, _patchedVaos. ClassifyBatches + ResolveTexture already migrated in Task 8 to use ulong bindless handles. BuildIndirectArrays (Task 9) wired in: _opaqueDraws + _translucentDraws are flattened into IndirectGroupInput[], laid out via the helper into contiguous indirect commands + parallel BatchData[]. opaqueByteOffset=0, transparentByteOffset = opaqueCount × DrawCommandStride. Visual verification (USER GATE) PASS: Holtburg courtyard renders identical to N.4 — terrain, scenery, characters, NPCs all visible without artifacts. [N.5] modern path capabilities present + mesh_modern shader loaded log lines confirm the boot path. [WB-DIAG] hot-path counters show healthy entity/draw activity. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b163c53622
commit
f533414edf
2 changed files with 123 additions and 95 deletions
|
|
@ -970,9 +970,9 @@ public sealed class GameWindow : IDisposable
|
|||
Path.Combine(shadersDir, "terrain.vert"),
|
||||
Path.Combine(shadersDir, "terrain.frag"));
|
||||
|
||||
_meshShader = new Shader(_gl,
|
||||
Path.Combine(shadersDir, "mesh_instanced.vert"),
|
||||
Path.Combine(shadersDir, "mesh_instanced.frag"));
|
||||
// mesh_instanced is the default; Task 10 (N.5) moves the final shader
|
||||
// selection to after capability detection so mesh_modern can be chosen
|
||||
// when bindless + ARB_shader_draw_parameters are available. See below.
|
||||
|
||||
// Phase G.1/G.2: shared scene-lighting UBO. Stays bound at
|
||||
// binding=1 for the lifetime of the process — every shader that
|
||||
|
|
@ -1447,6 +1447,23 @@ public sealed class GameWindow : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
// N.5 Task 10: load mesh_modern when both extensions are present;
|
||||
// fall back to mesh_instanced otherwise. Must be after capability
|
||||
// detection so _bindlessSupport is known.
|
||||
if (_bindlessSupport is not null)
|
||||
{
|
||||
_meshShader = new Shader(_gl,
|
||||
Path.Combine(shadersDir, "mesh_modern.vert"),
|
||||
Path.Combine(shadersDir, "mesh_modern.frag"));
|
||||
Console.WriteLine("[N.5] mesh_modern shader loaded");
|
||||
}
|
||||
else
|
||||
{
|
||||
_meshShader = new Shader(_gl,
|
||||
Path.Combine(shadersDir, "mesh_instanced.vert"),
|
||||
Path.Combine(shadersDir, "mesh_instanced.frag"));
|
||||
}
|
||||
|
||||
_textureCache = new TextureCache(_gl, _dats, _bindlessSupport);
|
||||
// Two persistent GL sampler objects (Repeat + ClampToEdge) so
|
||||
// the sky pass can pick wrap mode per submesh without mutating
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue