Commit Graph
1212 Commits
Author SHA1 Message Date
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 0c5e9e04b5 Also generate the fragment shaders 2026-05-18 14:14:29 +02:00
Henrik Rydgård ebad3401d4 Finish vshader generation 2026-05-18 14:14:29 +02:00
Henrik Rydgård 6f0a16a4a4 Fix Y flip 2026-05-18 14:14:25 +02:00
Henrik Rydgård cb2f5bf945 UI shaders: Convert the first shader to being generated 2026-05-18 14:11:39 +02:00
Henrik Rydgård 947217d1be Convert the pre-rotation to just the matrix multiplication. 2026-05-17 10:59:40 +02:00
Henrik Rydgård 8dc3e8ed14 Add depthMinusOneToOne to specify GL's ridiculous behavior 2026-05-14 22:13:04 +02:00
Henrik Rydgård 85ddf03c4b Vulkan: Remove deprecated use of device layers 2026-05-13 23:09:04 +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 ed274c8a7e Just some lint fixing 2026-05-13 11:37:26 +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
Henrik RydgårdandGitHub 575e08ff6c Merge pull request #21589 from hrydgard/assorted-ui-fixes
Fix display of HTTP links in recents list
2026-04-24 13:21:19 +02:00
Henrik Rydgård b2d0b8e3cc Improve display of http links in recents list 2026-04-23 16:55:29 +02:00
Henrik Rydgård d108fe25d1 Rework constant buffer loading, barrier fix 2026-04-23 13:32:06 +02:00
Henrik Rydgård 4c2be7f8af More work. Some initialization order problem. 2026-04-23 13:31:51 +02:00
Henrik Rydgård 4335a327cd Hackery to prepare for constant buffers in compute 2026-04-23 13:31:51 +02:00
Henrik Rydgård 317f811ca2 Slight improvement to our terrible GPU performance heuristic 2026-04-07 11:39:39 -06:00
Henrik Rydgård 02a624075a Android: Make the "Auto" rotation mode override user rotation lock (SENSOR mode) 2026-03-31 10:43:27 -06:00
Henrik Rydgård 3083d37728 Add support for the raintegration menu rebuild event 2026-03-26 17:18:12 -06: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
Henrik RydgårdandGitHub 836bbaf4c8 Merge pull request #21398 from chealy/fix-panfrost-gles3
OpenGL: Fix GLES3 detection for Mesa/Panfrost Mali drivers
2026-03-17 22:43:38 +01:00
Henrik RydgårdandGitHub 30c717cb4a Merge pull request #21386 from chealy/gpu-shader-optimizations
GPU: Shader optimizations using inversesqrt and dead code removal
2026-03-17 22:31:06 +01:00
Henrik Rydgård 7e3079b035 VulkanRenderManager: Try to survive StopThreads being called twice (shouldn't happen, but...) 2026-03-13 10:33:00 +01:00
Chris Healyandcphealy 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
Chris Healyandcphealy 9ed5dcdc27 GPU: Use inversesqrt for light distance and half-vector calculations
Replace length()/normalize() with inversesqrt() pattern for better
performance on mobile GPUs. The inversesqrt instruction is a single
hardware operation, while length() requires sqrt(dot()) and normalize()
requires inversesqrt internally plus a multiply.

Changes:
1. Light distance calculation:
   Before: distance = length(toLight); toLight /= distance;
   After:  distSq = dot(toLight, toLight);
           invDist = inversesqrt(distSq);
           distance = distSq * invDist;
           toLight *= invDist;

2. Specular half-vector normalization:
   Before: ldot = dot(normalize(toLight + vec3(0,0,1)), worldnormal);
   After:  halfVec = toLight + vec3(0,0,1);
           halfInvLen = inversesqrt(dot(halfVec, halfVec));
           ldot = dot(halfVec, worldnormal) * halfInvLen;

Also reuses distSq in attenuation calculation to avoid recomputing
distance*distance.

Offline shader compiler results (vertex shader with 4-light ubershader):

Mali (malioc):
  G31 (Bifrost): 44.90 -> 40.50 cycles (-9.8%)
  G52 (Bifrost): 14.97 -> 13.50 cycles (-9.8%)
  G310 (Valhall): 13.88 -> 12.88 cycles (-7.2%)
  G57 (Valhall):  7.60 ->  6.97 cycles (-8.3%)

PowerVR (Profiling Compilers):
  Series 8 GE8300: 322 -> 302 ALU cycles (-6.2%)
  Series 9 GM9445: 296 -> 280 ALU cycles (-5.4%)
  Series B BXM:    560 -> 540 instructions (-3.6%)

Signed-off-by: Chris Healy <cphealy@gmail.com>
2026-03-08 19:13:41 -07:00
Henrik Rydgård 5e6ec70280 Minor stuff 2026-03-01 12:09:43 +01:00
Henrik Rydgård 845f9f3d55 Add missing check to Vulkan init. Disable validation on android-x86-64
The latter is broken in the Android SDK emulator.
2026-02-27 23:57:50 +01:00
Henrik Rydgård 9097dd935a Somewhat improve the UI of the adhoc server list 2026-02-26 17:17:42 +01:00
Henrik Rydgård e50199ad0a Fix the gemini-written video player to actually work 2026-02-26 09:33:26 +01:00
Henrik Rydgård 5aeb38412d Fix another valgrind warning 2026-02-19 11:46:14 +01:00
Henrik Rydgård 5a5c7028b9 Assorted warning fixes and data initialization to please valgrind 2026-02-19 11:24:46 +01:00
Henrik Rydgård 5b33918ac4 VulkanBarrier: Change a hard assert to a debug assert, add fallback code. 2026-02-18 11:35:55 +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 facf6cb4b9 Vulkan: Try to survive VK_ERROR_SURFACE_LOST_KHR 2026-02-17 10:18:08 +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 00b28e28dc Mac/iOS: Avoid a vulkan warning about primitive restart 2026-02-10 10:41:52 +01:00
Henrik Rydgård eb234a1563 Finish the split. Greatly simplifies the render code in EmuScreen. 2026-02-08 10:46:16 +01:00
Henrik Rydgård 236a0acf71 Minor tweaks 2026-02-06 11:37:09 +01:00
Henrik Rydgård 841e4c8564 Add various checks trying to avoid various crashes found in Google Play crash reports. 2026-02-05 11:12:53 +01:00
Henrik Rydgård 0c3f6afeef Vulkan: Fix MSAA crash due to silly typo 2026-02-05 11:03:33 +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 68a8ba856f Warning fix, delete unused code 2026-01-24 10:43:48 +01:00
Henrik Rydgård 7bca84252e Vulkan: Add support for doing intra-buffer block copies with vkCmdCopyImage. 2026-01-22 13:47:41 +01:00
Henrik Rydgård f12472aede Give a name to an old mali GPU bug 2026-01-22 13:32:43 +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