2 Commits
Author SHA1 Message Date
sgiannop 9efe1c6471 perf/diag: VBO double-buffering + in-game timing overlay
VBO double-buffering (New3D):
- Allocate 2x RAM region [ROM_VERTS][RAM_slot0][RAM_slot1]; toggle
  m_ramSlot each frame so CPU writes slot N while GPU reads slot N-1.
- GL_MAP_UNSYNCHRONIZED_BIT added to UpdateDynamic: safe with double-
  buffer, eliminates driver GPU sync stall on GLES3/TBDR.
- vboOffset for RAM models adjusted to include slot offset.
- ramVerts guard: clamp upload to MAX_RAM_VERTS to prevent overflow
  at high PPC frequencies (66MHz+ generates more geometry per frame).

Shader (R3DShaderTriangles.h):
- Fragment 'in' varyings annotated with explicit 'highp' to match vertex
  shader output precision. Required for GLES3 precision consistency;
  also prepares for future mediump fragment optimisation.
- GetR3DFragment() helper added to GLSLVersion for when mediump fragment
  path is properly implemented (not yet wired in).

In-game timing overlay (libretroGui):
- Libretro_InitOverlay / Libretro_ShutdownOverlay / Libretro_DrawTimingOverlay
  added; renders ImGui window with PPC/Render/GPU/Sync/Sound/Total (ms).
- GPU timer via GL_EXT_disjoint_timer_query if available (guarded against
  NULL function pointer); shows 0.0ms when extension absent.
- Overlay initialised in context_reset, destroyed in context_destroy.

Model3.cpp: remove leftover DumpTimings() debug call from RunMainBoardFrame.
2026-06-21 14:52:15 +03:00
sgiannop 1017fff722 Centralize GLES shader version logic into helper class
Refactor scattered GLSL version selection logic from 7 files into a single
reusable Graphics::GLSLVersion helper class. This addresses duplicate
preprocessor conditionals and inconsistent platform detection across the
codebase.

Changes:
- Create GLSLVersion.h with PrecisionFlags enum and 7 public methods
- Create GLSLVersion.cpp with platform detection and precision logic
- Refactor Render2D.cpp, SuperAA.cpp, R3DFrameBuffers.cpp, R3DScrollFog.cpp,
  R3DShader.cpp, libretroCrosshair.cpp, libretroGui.cpp to use helper class
- Update Makefile.common to include GLSLVersion.cpp in build

Benefits:
- ~45 lines of scattered #ifdef logic centralized to 1 class
- Consistent platform detection across all files
- Bug fix: Render2D now checks HAVE_GLES (was missing before)
- Flexible API allows easy addition of new shader type support
- No performance impact; lightweight inline-eligible methods
- Single point of maintenance for shader version requirements

Related-To: #3
2026-04-03 13:31:58 +03:00