Twenty-five files used std::min, std::max, std::clamp or std::transform
without including <algorithm>, relying on other headers to bring it in,
which newer libstdc++ no longer does. Use libretro-common's MIN and MAX
(retro_miscellaneous.h) instead, keeping arguments that are calls in a
local first so they are evaluated once, and lowercase the boot path's
extension with tolower in a loop.
MAX(w >> level, 1u) compiles to the same instructions as std::max;
MIN(MAX(x, -1.0), 1.0) is two instructions shorter than std::clamp on
the common path.
ASSERT_MSG, DEBUG_ASSERT_MSG, ASSERT and DEBUG_ASSERT now go through
the printf-checked PanicYesNoAssert/PanicYesNo alerts instead of fmt.
Every call site is converted with explicit casts for 64-bit and
platform-dependent types, so the format strings are compiler-checked
on Linux, Windows and Android.
The OpenGL AA mode assertions format the mode list into a stack
buffer instead of fmt::join, dropping the last <fmt/ranges.h> user
there.
The sampler and attribute names are formatted into buffers on the
stack, the GLSL header with StringFromFormat, and the missing extensions
into a buffer on the stack; a shader that fails is dumped by appending
its parts. Only the two AA mode assertions still use fmt, until the
assertions move over.
Nothing in the libretro core drives the debugger, so its hooks only cost:
the per-access memcheck in MMU reads and writes, the breakpoint check in
the CPU run loop, branch watch calls in the interpreter and both JITs,
JIT profiling, CPU and DSP single stepping (and the DSP's 64 KiB
breakpoint table and step event). The network capture logger moves out
of PPCDebugInterface into NetworkCaptureLogger; ApplyMemoryPatch moves
into PatchEngine. Behaviour with debugging off is unchanged.
Where the driver compiles on threads of its own
(GL_KHR_parallel_shader_compile or the ARB one), the asynchronous
shader modes on OpenGL compile in the background on the frontend's
context alone: a missing program's compile and link are started, a
couple of work items a frame, and its draws use the ubershaders, or
are skipped, until GL_COMPLETION_STATUS says the link is done; its
link is checked, its variables set and its binary written to the cache
then. A program drawn with before it is done is waited for there. A
software rasterizer, which compiles when it first draws, compiles on
the spot as before.
The shader compiler gets a deferred mode for it, without threads,
compiling the items waiting a few at a time, and AbstractPipeline tells
whether a pipeline's compile is still running and whether it can be
drawn with. With the driver's threads alone, every ubershader pipeline
there can be is not built in the background.
The OpenGL renderer draws on the context the frontend hands over
through libretro GL, and the core makes no context of its own: the
platform context code goes, EGL, EGLX11, EGL for Android, WGL, AGL,
BGL and the GLX window, with the shared contexts made for the shader
compiler's threads, and GLContext::Create makes the libretro context
alone. Programs are compiled on the frontend's context, so the OpenGL
backend reports no background compiling and its shader compiler runs
no threads; the shared-context compiler, its glFinish and VAO rebinds
and the driver bug that switched it off go with it. Android no longer
links libEGL.
Nothing is drawn over the game any more. The OSD message queue, the
ImGui overlay that drew it (with the shader-compile progress window and
the statistics, projection and scissor windows), and the imgui and implot
libraries are removed from the build.
Core::DisplayMessage now writes to the log, and the former OSD calls
go through it. Shader compilation no longer presents frames outside
retro_run while it waits.
Deleted with it: the "OSD enabled" core option, the OSD, FPS, speed,
graph, statistics and internal-resolution display settings, and the
ImGui shaders and texture conversion.
Drop DolphinAnalytics and Common/Analytics along with every game-quirk,
game-start, performance-sample and GPU-bug-override report, the
Main.Analytics settings, and the Android opt-in dialog, settings
entries, JNI hooks and session-timestamp tracking that only fed it.
DriverDetails loses its to_string helpers and stored driver name,
which only built the bug-override report.
Yellow squiggly lines begone!
Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes.
If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed.
The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports.
Not everything is removed, but the cleanup should be substantial enough.
Because this done on Linux, code that isn't used on it is mostly untouched.
(Hopefully no open PR is depending on these imports...)
In OGLConfig.cpp, `std::views::reverse` is used rather than sorting using `std::ranges::greater` in order to parallel other instances of reverse iteration in the function.
bSupports2DTextureStorageMultisample is completely unused, while bSupports3DTextureStorageMultisample is practically unused. In the past, these were checked and fell back to sampler2DMS instead of sampler2DMSArray on GLES 3.1, but this path was removed in f039149198 and Dolphin always uses array textures now.
While the NV extension is totally fine, the KHR extension should be able to support more hardware.
For NVIDIA, the hardware either supports both or neither, it just needs a driver from the last two years.
For AMD, the drivers from late 2022-12 seems to bring support for the KHR extension.
For Intel, the KHR is also supported for some years.