Adds DrawElementsIndirectCommand struct (20-byte layout for glMultiDrawElementsIndirect). Replaces _instanceVbo field on WbDrawDispatcher with three buffers: _instanceSsbo (mat4[]), _batchSsbo (BatchData[]), _indirectBuffer (DEIC[]). Adds BindlessSupport constructor parameter — non-null required since the dispatcher is only constructed when WB foundation is on (which implies bindless is present per Task 6 capability detection). Existing Draw() method substitutes _instanceVbo -> _instanceSsbo for compile. Behavior is temporarily wrong (SSBO bound as ArrayBuffer for per-vertex attribs); Tasks 9-10 fully rewrite the draw loop and the per-frame uploads to use BindBufferBase + glMultiDrawElementsIndirect. GameWindow construction site updated to add _bindlessSupport guard and pass it as the new last argument to the constructor. Dispatcher is only constructed when bindless is guaranteed present. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
17 lines
683 B
C#
17 lines
683 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace AcDream.App.Rendering.Wb;
|
|
|
|
/// <summary>
|
|
/// Layout matches what <c>glMultiDrawElementsIndirect</c> expects.
|
|
/// Total size 20 bytes; arrays are typically uploaded with stride = sizeof(this).
|
|
/// </summary>
|
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
|
public struct DrawElementsIndirectCommand
|
|
{
|
|
public uint Count; // index count for this draw
|
|
public uint InstanceCount; // number of instances
|
|
public uint FirstIndex; // offset into IBO, in indices
|
|
public int BaseVertex; // vertex offset into VBO
|
|
public uint BaseInstance; // first instance ID (offsets per-instance attribs / SSBO read)
|
|
}
|