393 Commits

Author SHA1 Message Date
Henrik Rydgård f60e27a9b7 Just some refactoring of the GPUStatistics struct, and more use of StringWriter 2026-05-29 14:40:31 +02:00
Herman Semenoff b1d140e8e7 OpenGL/Vulkan/UI: duplicate fields move to separate const reference var 2026-05-27 12:26:12 +02:00
Henrik Rydgård dd125b2e4d Delete obsolete (and non-working) support for GPUs without non-pow-2 textures. 2026-05-24 14:15:34 +02:00
Henrik Rydgård 2a745bc98d Apple buildfix 2026-05-21 16:36:32 +02:00
Henrik Rydgård 4a420c95c2 Remove some redundant device caps, show clip/cull/depth-clamp in system info 2026-05-21 11:59:26 +02:00
Henrik Rydgård 28166cb35d Add "allocation slack" to our pushbuffers. Fixes a memory overwrite bug
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.
2026-05-13 15:55:34 +02:00
Henrik Rydgård a78e0e76de Disable the GPU profiler for OpenGL. Also restrict to in-game. 2026-05-06 00:27:20 +02:00
Chris Healy 49bfbd49cd OpenGL: Integrate GLProfiler into render pass execution
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>
2026-03-18 09:52:43 -07:00
Chris Healy ba59170b0b OpenGL: Add GLProfiler for GPU timestamp profiling
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>
2026-03-18 09:52:43 -07:00
Chris Healy 856e6ed49b OpenGL: Add timer query extension detection
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>
2026-03-18 09:52:42 -07:00
Chris Healy 7ea1260ef0 OpenGL: Fix GLES3 detection for Mesa/Panfrost Mali drivers
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>
2026-03-08 21:41:20 -07:00
Henrik Rydgård 5e6ec70280 Minor stuff 2026-03-01 12:09:43 +01:00
Henrik Rydgård 48c6faa762 ImDebugger: Fix texture viewer in OpenGL mode and partially in D3D11 mode (swapped colors) 2026-02-17 18:19:23 +01:00
Henrik Rydgård 1cc2b7233a Fix some minor visual UI issues
See #21223
2026-02-15 19:57:56 +01:00
Henrik Rydgård 2c0bdcf678 InstallZipScreen improvements, small cleanup 2026-02-10 11:34:59 +01:00
Henrik Rydgård d6ebfed432 Fix some bugs and warnings from a pass of static analysis 2026-01-29 17:41:54 +01:00
Henrik Rydgård 64461329e7 More minor fixes and cleanups 2026-01-02 14:20:20 +01:00
Henrik Rydgård 02d621c0f6 OpenGL ES: Correct check for 3D texture support. 2026-01-02 14:20:20 +01:00
Henrik Rydgård 1ac218960f OpenGL / FramebufferManager: Improve asserts for raster blits 2026-01-01 14:15:37 +01:00
Henrik Rydgård c999367471 Fix crash in DrawPixels in "skip framebuffer effects" mode 2025-12-15 17:18:17 +01:00
Henrik Rydgård 1efcaafd5a Add query for max texture size 2025-11-15 15:26:02 +01:00
Henrik Rydgård 7cc4a0f3a3 Add more accurate sleep function (well, not more accurate on Windows unfortunately) 2025-10-21 12:11:23 +02:00
Henrik Rydgård d265336912 Warning fix 2025-10-21 11:16:19 +02:00
Henrik Rydgård c5b1f2ffb0 OpenGL: Call SwapInterval properly 2025-10-20 22:45:42 +02:00
Henrik Rydgård 042cf87248 Rework the present mode settings, refactor. 2025-10-20 21:28:38 +02:00
Henrik Rydgård 176c55da25 Remove unused "interval" concept from presentation mode 2025-10-19 18:18:06 +02:00
Henrik Rydgård d43b1d4618 String function cleanup 2025-08-31 14:45:41 +02:00
Henrik Rydgård 9218fe9b59 Rework the shutdown logic in the OpenGL backend. Eliminated race conditions. 2025-08-31 10:57:06 +02:00
Henrik Rydgård b813a6c30f Logging improvements 2025-08-31 00:59:51 +02:00
Henrik Rydgård 539abb8d4f More minor cleanups 2025-08-31 00:59:51 +02:00
Henrik Rydgård 00a13bfb14 Fix static analysis warnings (pointless move, empty instead of size) 2025-08-31 00:59:51 +02:00
Henrik Rydgård 6cfea96e58 Remove D3D9 support, to make future changes easier 2025-06-10 15:07:16 +02:00
Henrik Rydgård dbe6ec80a0 Fix some bad "for (auto x : y)" usage 2025-04-29 16:46:14 +02:00
Henrik Rydgård 41b77bf1ae More log cleanup 2025-04-14 22:27:51 +02:00
Henrik Rydgård 4dd3621fa0 Remove some unnecessary <algorithm> includes. 2024-12-18 17:04:27 +01:00
Henrik Rydgård 111d0c872d Global rename of FBChannel to Aspect, also make it a class enum 2024-12-15 22:24:05 +01:00
Henrik Rydgård 6763c13f88 ImGui: Finish implementing pipeline switching for all backends 2024-11-27 01:19:05 +01:00
Henrik Rydgård 09779e0f44 ImGui drawing: Allow varying the pipeline when binding textures 2024-11-26 19:59:09 +01:00
Henrik Rydgård eaff38f161 Implement ImGui clipped batch texturing support in the other backends too 2024-11-26 09:38:30 +01:00
Henrik Rydgård c6c9e32d15 Fix the ImDebugger on OpenGL 2024-11-21 15:48:18 +01:00
Henrik Rydgård 472103d460 Back out the 32-bit index buffer support. Not actually needed for ImGui. 2024-11-04 23:14:39 +01:00
Henrik Rydgård 184a3ecf2a Code fixes. Correct the UWP fix 2024-11-04 23:14:39 +01:00
Henrik Rydgård 17a7c80cb1 Get it rendering on Vulkan and D3D11 (OpenGL is bugged though) 2024-11-04 23:14:39 +01:00
Henrik Rydgård d37c04079d Change the 2D matrix generation to query the coordinate convention from the draw context 2024-11-04 23:14:23 +01:00
Henrik Rydgård 8f8598c347 thin3d: Add partial support for 32-bit index buffers. Add DrawIndexedUP. 2024-11-04 23:14:22 +01:00
Henrik Rydgård a545d3074f Do some renaming, dedupe some strings (old commit resurrected), add an assert 2024-10-22 22:28:06 +02:00
Henrik Rydgård a6a189c24d An old version of android had strict JNI validation of UTF-8 strings enabled. Let's pass it. 2024-10-22 11:02:26 +02:00
Henrik Rydgård e1527233d9 Add the EmuScreen pass assert on OpenGL as well 2024-10-14 14:35:35 +02:00
Henrik Rydgård 4d6905672e Bunch more linting 2024-10-10 11:57:10 +02:00
Henrik Rydgård e0c12c9547 More lint warning fixes 2024-10-10 10:52:45 +02:00