Commit Graph
88 Commits
Author SHA1 Message Date
LibretroAdmin bc09a84dd1 GL: programs compiled on the driver's threads, drawn with once linked
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.
2026-11-07 02:05:36 +01:00
LibretroAdmin e4bac5f75c Shaders: ubershaders by default, seeded per game
Shader compilation defaults to Async (UberShaders): a draw whose own
pipeline is not built yet is drawn with an ubershader one, exact
rendering, while its own builds on the compiler threads, which now
number as many as the machine has to spare (cores - 3, 1 to 4) instead
of one.

What is left to stutter is an ubershader pipeline itself, built on the
spot the first time a draw needs one: one per vertex layout and fixed
function state. Every ubershader pipeline a draw uses is now recorded,
in <game id>.uberuidcache next to the specialized UID cache, and those
are built before the game starts the next time it boots; every other
ubershader pipeline there can be, and the specialized pipelines known,
build in the background while it runs instead of before it starts,
which took 21 s on lavapipe. The record is written when the cache
closes, into room reserved when it opens, so recording allocates
nothing in the middle of a game.

Without compiler threads (OpenGL here, with no shared context for
them), asking for a pipeline in the background builds it on the spot
and an ubershader one besides: the asynchronous modes draw as
Synchronous does then, and nothing extra is built before the game
starts.

Booting a FIFO log no longer hangs: the CPU thread clears the EFB, which
waits on the GPU, before it reaches its run loop, and the frontend's
thread waited for that run loop without running the GPU. It runs the
GPU until then.
2026-11-06 23:07:17 +01:00
LibretroAdmin 05a95eb519 VideoCommon, backends: remove the shader includer
Nothing ever made one: every backend was handed a null includer, and the
OpenGL backend's #include resolver returned the source untouched. The
parameter goes from CreateShaderFromSource and everything beneath it,
and ShaderCompileUtils with it.
2026-11-06 04:34:32 +01:00
LibretroAdmin a2404c6e43 Remove the on-screen messages and the ImGui overlay
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.
2026-11-05 23:34:25 +01:00
LibretroAdmin 472dc5ae3f Remove user post-processing shaders and graphics-mod custom shaders
Both fed user-written GLSL to the backends at runtime, which the move to
bytecode emitted straight from the shader generators leaves no compiler
for. The frontend's own shader pipeline covers post-processing.

The presentation pass keeps a plain copy and the built-in correction
shader for output resampling, colour space and gamma correction and HDR
scaling, now compiled in rather than loaded from Sys/Shaders. The
graphics-mod system keeps its draw, EFB, projection and texture actions;
custom pipelines, materials, shader, mesh and sampler assets, the custom
constant buffers in every backend and the two mods built on them are
gone, along with the shader generators' custom-shader hooks.
2026-11-05 15:57:56 +01:00
RTA 9b56760080 Restored original comments 2026-09-24 19:46:18 +02:00
RTA ffbadf1904 Defer libretro pipeline UID cache writes
Queue newly discovered GX pipeline UIDs during rendering and append them when the cache closes on reload or shutdown. Keep the existing immediate writes for standalone Dolphin.
2026-09-24 01:11:11 +02:00
Martino Fontana 95dec13203 Improve usage of std::move and const references parameters
Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`.

Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move.

Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible.
2026-04-17 12:39:46 +02:00
JMC47 0a3aac6d85 Merge pull request #14043 from iwubcode/custom_resource
VideoCommon: separate the concept of a 'resource' from an 'asset', add Material/Shader loading
2025-12-22 17:08:02 -05:00
iwubcode 8016e2cfbd VideoCommon: move ApplyDriverBugs for the normal pipeline out into a utility function, add a way to hash the pipeline (using the vertex declaration instead of the native vertex format) 2025-11-23 11:04:24 -06:00
iwubcode 75c66e35c6 VideoCommon: add method to async shader compiler to clear pending/completed work (used on shutdown), this will in turn clear up any resources that the worker items may have held onto 2025-11-21 01:17:45 -06:00
Jordan Woyak da6c65bf3b Common: Remove the string parameters from the HookableEvent interface. 2025-11-06 22:34:40 -06:00
Jordan WoyakandDentomologist f289b06e0d Common: Make HookableEvent use non-static data.
Co-authored-by: Dentomologist <[email protected]>
2025-11-02 17:30:43 -06:00
iwubcode 96fe6a1575 VideoBackends / VideoCommon: add support for specifying include files in shader code 2025-10-26 22:47:23 -05:00
iwubcode 14459bcc1b VideoBackends / VideoCommon: rename member variables in RenderState to be consistent 2025-08-23 13:50:22 -05:00
Sintendo f2392e4048 Avoid map/set double lookups
Fix some common anti-patterns with these data structures.

- You can dereference the iterator returned by `find` to access the
  underlying value directly, without an extra `operator[]`/`at`.
- Rather than checking for an element before insertion/deletion, you can
  just do the operation and if needed check the return value to
  determine if the insertion/deletion succeeded.
2025-07-08 06:53:42 +02:00
iwubcode b23dddea4e VideoCommon: move vertex shader gen logic to a 'process_vertex()' function, to eventually allow for custom shaders to override vertex logic 2025-05-24 01:27:58 -05:00
iwubcode 8e253518e6 VideoCommon: move to a 'process_fragment()' function to simplify custom shaders and provide a direct override of the tev stage logic 2025-03-22 15:22:00 -05:00
Jordan Woyak c18c039089 VideoCommon: Move backend_info out of VideoConfig struct. 2025-03-09 01:42:45 -06:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
Lioncash cac66317aa VideoCommon/Statistics: Remove global system accessor from s_after_frame_event
Instead, we make the event take a reference to the system and then pass
it in when the event is triggered.

This does introduce two other accessors, but these are much easier to
refactor out over time, and without modification to the existing event
interface.
2024-01-31 13:12:09 -05:00
iwubcode 4283d76718 VideoCommon: uber pixel shader gen changes needed to support custom pixel shaders in graphics mods 2023-08-20 18:53:27 -05:00
iwubcode e704385fce VideoCommon: pixel shader gen changes needed to support custom pixel shaders in graphics mods 2023-08-20 18:53:27 -05:00
Lioncash 07ed932a09 Common/LinearDiskCache: Move interface into Common namespace
Gets the interface out of the global namespace.
2023-04-19 09:14:39 -04:00
Minty-Meeo 678c93589a Resolve [-Wclass-memaccess] 2023-04-12 03:59:57 -05:00
Pokechu22 3024ca2146 Suppress memcpy writing to an object with no trivial copy-assignment warnings
We need to copy padding in most of these cases, and the objects are trivially copyable; however, BitField prevents trivial copy-assignment.
2023-02-09 16:23:49 -08:00
Scott Mansell ccf92a3e56 Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
2023-02-09 19:59:16 +13:00
Scott Mansell 31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell 0da69055d9 Split out everying remaining from Swap 2023-01-31 19:41:24 +13:00
Scott Mansell b007b8e104 Replace BeginUI/EndUI 2023-01-31 19:41:24 +13:00
Scott Mansell 8a23629345 Split AbstractGfx out of Renderer
Almost all the virtual functions in Renderer are part of dolphin's
"graphics api abstraction layer", which has slowly formed over the
last decade or two.

Most of the work was done previously with the introduction of the
various "AbstractX" classes, associated with texture cache cleanups
and implementation of newer graphics APIs (Direct3D 12, Vulkan, Metal).
We are simply taking the last step and yeeting these functions out
of Renderer.

This "AbstractGfx" class is now completely agnostic of any details
from the flipper/hollywood GPU we are emulating, though somewhat
specialized.

(Will not build, this commit only contains changes outside VideoBackends)
2023-01-31 18:46:02 +13:00
Scott Mansell 0d4537d60f Move Presenting, Dumping and ImGui out of Renderer 2023-01-31 18:45:21 +13:00
TellowKrinkle 600ad5f498 VideoCommon: Better logic op invert approximation 2023-01-30 14:04:37 -06:00
TellowKrinkle 68f49df0f8 VideoCommon: Add vertex shader point and line expansion 2022-10-22 20:13:24 -05:00
TellowKrinkle 99533d2840 VideoCommon: Add separate pipeline usage for UberShaders 2022-09-19 16:28:24 -05:00
TellowKrinkle d289e9c51c VideoCommon: Compile a few extra pipelines 2022-09-19 16:28:24 -05:00
TellowKrinkle 4c629c2bee VideoCommon: Add dynamic vertex loader to ubershaders 2022-09-19 16:28:23 -05:00
TellowKrinkle 991024173e VideoCommon: Always use fbfetch in ubershaders if available
Reduce the number of different pipelines needed.  Also works around drivers that break when you combine fbfetch with dual source blending
2022-07-15 15:31:47 -05:00
TellowKrinkle 6ab24e6c17 VideoCommon: Better driver bug handling
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader
2022-07-13 21:51:24 -05:00
Admiral H. Curtiss e072aaa769 ShaderCache: Fix inverted usage of palette_format. 2022-07-09 13:17:53 +02:00
Admiral H. Curtiss 3bcd7aced9 Merge pull request #8467 from CookiePLMonster/interruptable-shader-precompile
Make shader precompilation interruptable
2022-07-02 13:08:37 +02:00
TellowKrinkle f79ac768d8 VideoCommon:ShaderCache: Add const to some local variables 2022-06-17 20:14:32 -05:00
TellowKrinkle c7892d7371 VideoCommon: Name ubershaders 2022-06-16 02:08:45 -05:00
TellowKrinkle 23c1721fbd VideoCommon: Reduce duplicates of non-palette-requiring texture decode shaders 2022-06-16 02:08:45 -05:00
Silent 7faf5ea170 Clear the UI after async shader compilation 2022-06-10 17:19:59 +02:00
Silent dcad3ec892 Allow to interrupt shader precompilation by stopping emulation 2022-06-10 17:11:32 +02:00
Admiral H. Curtiss 36cfcb530f IOFile: Make origin parameter to Seek() an enum class. 2022-01-29 06:49:21 +01:00
Pokechu22 afd02b79a5 VideoCommon: Add names for textures and shaders 2022-01-01 11:38:56 -08:00
JMC47 b1f79d9ecf Merge pull request #10215 from OatmealDome/shader-logic-ops
VideoCommon: Support shader logic ops on Metal (Apple GPUs) and OpenGL ES
2021-12-22 16:39:54 -05:00
Pokechu22 27cb704466 Eliminate VarType for ComponentFormat 2021-12-18 15:21:48 -08:00