fix(render): skip empty groups in instanced draw to prevent crash on Tab

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-13 18:55:29 +02:00
parent 6a55838a10
commit 787e0f0aff
2 changed files with 98 additions and 0 deletions

View file

@ -227,6 +227,7 @@ public sealed unsafe class InstancedMeshRenderer : IDisposable
// group share the same GfxObj so they have compatible overrides
// only in the degenerate case of mixed-palette entities using the
// same GfxObj — rare enough to accept the approximation here).
if (grp.Count == 0) continue;
var firstEntry = grp.Entries[0];
uint tex = ResolveTex(firstEntry.Entity, firstEntry.MeshRef, sub);
_gl.ActiveTexture(TextureUnit.Texture0);
@ -295,6 +296,7 @@ public sealed unsafe class InstancedMeshRenderer : IDisposable
false, 64, (void*)(byteOffset + row * 16));
}
if (grp.Count == 0) continue;
var firstEntry = grp.Entries[0];
uint tex = ResolveTex(firstEntry.Entity, firstEntry.MeshRef, sub);
_gl.ActiveTexture(TextureUnit.Texture0);