phase(N.5) Task 6 fixup: log symmetry + Silk extension shortcut

Code quality review caught:
- Silent failure when ARB_bindless_texture absent — the && short-circuit
  meant the most common fallback case (no bindless on the GPU) had no
  log, while ARB_shader_draw_parameters absent did log. Restructured to
  three nested ifs so each failure path logs symmetrically.
- Redundant `bindless is not null` guard removed (TryCreate's non-null
  guarantee covers it; the nested-if structure makes this implicit).
- HasShaderDrawParameters in BindlessSupport.cs replaced its manual
  GL_NUM_EXTENSIONS scan with `gl.IsExtensionPresent(...)` — same
  pattern WB uses, less code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-08 20:21:10 +02:00
parent 93ebd9e433
commit 12170f9d78
2 changed files with 13 additions and 15 deletions

View file

@ -1427,18 +1427,23 @@ public sealed class GameWindow : IDisposable
// 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 (AcDream.App.Rendering.Wb.WbFoundationFlag.IsEnabled)
{
if (bindless.HasShaderDrawParameters(_gl))
if (AcDream.App.Rendering.Wb.BindlessSupport.TryCreate(_gl, out var bindless))
{
_bindlessSupport = bindless;
Console.WriteLine("[N.5] modern path capabilities present (bindless + ARB_shader_draw_parameters)");
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");
}
}
else
{
Console.WriteLine("[N.5] GL_ARB_shader_draw_parameters not present — modern dispatch path will not activate");
Console.WriteLine("[N.5] GL_ARB_bindless_texture not present — modern dispatch path will not activate");
}
}

View file

@ -50,13 +50,6 @@ public sealed class BindlessSupport
/// from this extension.</summary>
public bool HasShaderDrawParameters(GL gl)
{
int n = 0;
gl.GetInteger(GLEnum.NumExtensions, out n);
for (int i = 0; i < n; i++)
{
string ext = gl.GetStringS(StringName.Extensions, (uint)i);
if (ext == "GL_ARB_shader_draw_parameters") return true;
}
return false;
return gl.IsExtensionPresent("GL_ARB_shader_draw_parameters");
}
}