diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 1048e02..6ba12a7 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -33,6 +33,10 @@ public sealed class GameWindow : IDisposable private AcDream.App.Rendering.Wb.WbMeshAdapter? _wbMeshAdapter; private AcDream.App.Rendering.Wb.EntitySpawnAdapter? _wbEntitySpawnAdapter; private AcDream.App.Rendering.Wb.WbDrawDispatcher? _wbDrawDispatcher; + /// Phase N.5: ARB_bindless_texture + ARB_shader_draw_parameters + /// support. Non-null only when both extensions are present and WbFoundation + /// is enabled. Passed to TextureCache and (later) WbDrawDispatcher. + private AcDream.App.Rendering.Wb.BindlessSupport? _bindlessSupport; private SamplerCache? _samplerCache; private DebugLineRenderer? _debugLines; // K-fix4 (2026-04-26): default OFF. The orange BSP / green cylinder @@ -1419,7 +1423,26 @@ public sealed class GameWindow : IDisposable _heightTable = heightTable; _surfaceCache = new Dictionary(); - _textureCache = new TextureCache(_gl, _dats); + // N.5: detect ARB_bindless_texture + ARB_shader_draw_parameters when WB + // foundation is on. Store the BindlessSupport for TextureCache + future + // WbDrawDispatcher. Mesh shader load stays as mesh_instanced for now — + // Task 10 swaps to mesh_modern after the dispatcher is rewired. + if (AcDream.App.Rendering.Wb.WbFoundationFlag.IsEnabled + && AcDream.App.Rendering.Wb.BindlessSupport.TryCreate(_gl, out var bindless) + && bindless is not null) + { + if (bindless.HasShaderDrawParameters(_gl)) + { + _bindlessSupport = bindless; + Console.WriteLine("[N.5] modern path capabilities present (bindless + ARB_shader_draw_parameters)"); + } + else + { + Console.WriteLine("[N.5] GL_ARB_shader_draw_parameters not present — modern dispatch path will not activate"); + } + } + + _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 // shared per-texture wrap state. See SamplerCache + the