This is a leftover from the old "native" library. Its only users are the Win32 GE
debugger's preview windows, which call glsl_create_source/destroy/bind/unbind and
read four locations off the struct.
Everything else was dead: glsl_create was declared but never defined anywhere,
which made the entire file-loading and auto-reload half of glsl_recompile
unreachable (glsl_create_source always passes empty filenames), along with the
mtime fields, AutoCharArrayBuf and the VFS/stat includes. glsl_attrib_loc,
glsl_uniform_loc and glsl_get_program had no callers, and the active_programs set
was written and never read. The unused convenience locations cost a
glGetUniformLocation round trip each at link time.
The bug: the vertex shader was leaked when its own compile failed - the fragment
path right below it already deleted it correctly. Failed links leaked the program
object too.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
The Intel workaround sscanf'd "Build %d.%d.%d.%d" against glGetString(GL_VERSION),
which reads like "4.5.0 - Build 26.20.100.7870" - sscanf literals have to match
from the start, so it never returned 4 and HasIntelDualSrcBug was never consulted.
It's been inert since it was written, and the drivers it targeted are long gone.
Removing it orphaned the two helpers, so those go too.
Separately, when gl3stubInit() fails we left ver[0] at 3 while clearing GLES3.
Extension enumeration keys off the version, not the flag, so it went on to call
glGetStringi - one of the very entry points whose absence makes gl3stubInit()
fail. Drop back to 2.0 on that path, like the branch above it already does, and
null-check what glGetStringi hands back.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
Reported by Joseph on Discord.
Sometimes, things could align perfectly so allocations happend exactly
at the end of a pushbuffer. At the same time, we allow our vertex decoder to write an extra few
bytes if it needs to for speed. Unfortunately I missed this interaction,
resulting in some uncommon crashes that were especially common with
heavy-geometry things like modified GTA LCS with PS2 assets, for
example.
The problem was reported with Vulkan, but our OpenGL backend had the
same issue too.
Integrates the GLProfiler into GLQueueRunner to provide GPU timestamp
profiling for OpenGL render passes, similar to the Vulkan backend.
Profiled operations:
- RenderPass (with tag name for identification)
- Copy operations
- Blit operations
- Readback operations
- ReadbackImage operations
The profiler is initialized in CreateDeviceObjects() and shutdown in
DestroyDeviceObjects(). Timing results are logged each frame when the
GPU profile debug overlay is enabled.
Signed-off-by: Chris Healy <cphealy@gmail.com>
Adds a new GLProfiler class for GPU-side timestamp profiling, similar to
VulkanProfiler. Uses GL_EXT_disjoint_timer_query (GLES) or GL_ARB_timer_query
(desktop GL).
Features:
- Scoped Begin()/End() profiling with printf-style naming
- Automatic GPU disjoint detection (frequency changes invalidate results)
- Millisecond timing output via INFO_LOG
- Pre-allocated query pool (1024 queries max per frame)
- Nested scope support with indented output
Signed-off-by: Chris Healy <cphealy@gmail.com>
Add detection for GL_EXT_disjoint_timer_query (OpenGL ES) and
GL_ARB_timer_query (desktop GL) extensions. These extensions provide
GPU timestamp queries for profiling render pass durations.
Also adds function pointer declarations for glQueryCounter,
glGetQueryObjecti64v, and glGetQueryObjectui64v.
Signed-off-by: Chris Healy <cphealy@gmail.com>
The original code checked for "Mali" in GL_RENDERER and disabled GLES3
for all Mali GPUs, which was a workaround for bugs in ARM's proprietary
Mali driver. However, Mesa/Panfrost (open-source Mali driver) does not
have these bugs and should be allowed to use GLES3.
This patch:
- Adds GPU_VENDOR_MESA for identifying Mesa drivers via GL_VENDOR
- Changes the GLES3 ban to only apply when GL_VENDOR="ARM" (proprietary)
- Allows Mesa/Panfrost Mali GPUs to use GLES3 features
Expected behavior:
- ARM proprietary driver (GL_VENDOR="ARM"): GLES3 disabled (preserved)
- Mesa/Panfrost (GL_VENDOR="Mesa"): GLES3 enabled
- Other Mesa drivers: Unaffected
Related issues: #4078, #15413
Signed-off-by: Chris Healy <cphealy@gmail.com>