From 12170f9d784dedadbc63d4f854f82ec5cab7225f Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 8 May 2026 20:21:10 +0200 Subject: [PATCH] phase(N.5) Task 6 fixup: log symmetry + Silk extension shortcut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/AcDream.App/Rendering/GameWindow.cs | 19 ++++++++++++------- .../Rendering/Wb/BindlessSupport.cs | 9 +-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 6ba12a7..6c06a97 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -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"); } } diff --git a/src/AcDream.App/Rendering/Wb/BindlessSupport.cs b/src/AcDream.App/Rendering/Wb/BindlessSupport.cs index 1fd6701..eeb4f9d 100644 --- a/src/AcDream.App/Rendering/Wb/BindlessSupport.cs +++ b/src/AcDream.App/Rendering/Wb/BindlessSupport.cs @@ -50,13 +50,6 @@ public sealed class BindlessSupport /// from this extension. 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"); } }