5437 Commits
Author SHA1 Message Date
cbartondock 83dc4685aa waterfall loading of textures via id to prefer elfid-gameid when launched via elf; fallback to gameid if no match 2026-07-15 12:02:16 -07:00
Joshua Vandaële 55761d9e6d PerformanceMetrics: Fix compiling using clang&libstdc++
When using clang and libstdc++, compiling fails with these errors:

```
FAILED: [code=1] Source/Core/VideoCommon/CMakeFiles/videocommon.dir/PerformanceMetrics.cpp.o
/usr/sbin/ccache /usr/sbin/clang++ -DAUTOUPDATE=1 -DDATA_DIR=\"/usr/local/share/dolphin-emu/\" -DHAS_OPENGL -DHAS_VULKAN -DHAVE_CPPIPC -DHAVE_LIBSYSTEMD -DIMGUI_USER_CONFIG=\"imgui_user_config.h\" -DLZMA_API_STATIC -DOFF -DPUGIXML_NO_EXCEPTIONS -DRC_CLIENT_SUPPORTS_HASH -DSFML_STATIC -DSPNG_STATIC -DTINYGLTF_NOEXCEPTION -DTINYGLTF_NO_EXTERNAL_IMAGE -DTINYGLTF_USE_CPP14 -DUSE_ANALYTICS=1 -DUSE_MEMORYWATCHER=1 -DUSE_PIPES=1 -DUSE_RETRO_ACHIEVEMENTS -DZSTD_MULTITHREAD -D_ARCH_64=1 -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_M_X86_64=1 -D__LIBUSB__ -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/dolphin-local/Source/Core -I/dolphin-local/Externals/picojson -I/dolphin-local/build/release/x64/Source/Core -I/dolphin-local/Externals/enet/enet/include -I/dolphin-local/Externals/fmt/fmt/include -I/dolphin-local/Externals/mbedtls/include -I/dolphin-local/Externals/minizip-ng/minizip-ng -I/dolphin-local/Externals/liblzma/api -I/dolphin-local/Externals/zstd/zstd/build/cmake/../../lib -I/dolphin-local/Externals/libiconv/include -I/dolphin-local/build/release/x64/Externals/libiconv/lib -I/dolphin-local/Externals/libiconv/libcharset/include -I/dolphin-local/build/release/x64/Externals/libiconv/libcharset -I/dolphin-local/Externals/SFML/SFML/include -I/dolphin-local/Externals/bzip2/bzip2 -I/dolphin-local/Externals/expr/include -I/dolphin-local/Externals/hidapi/hidapi-src/hidapi -I/dolphin-local/Externals/pugixml/pugixml/src -I/dolphin-local/Externals/glslang/glslang/glslang/.. -I/dolphin-local/build/release/x64/include -I/dolphin-local/Externals/rcheevos -I/dolphin-local/Externals/libspng/libspng/spng -I/dolphin-local/Externals/xxhash/xxHash -I/dolphin-local/Externals/imgui -I/dolphin-local/Externals/imgui/imgui -I/dolphin-local/Externals/implot/implot -I/dolphin-local/Externals/glslang/glslang/SPIRV/.. -I/dolphin-local/Externals/tinygltf -isystem /dolphin-local/Externals/libusb/libusb/libusb -isystem /dolphin-local/Externals/glslang/glslang -isystem /dolphin-local/Externals/glslang/glslang/Public -isystem /dolphin-local/Externals/glslang -Qunused-arguments -fcolor-diagnostics -O3 -DNDEBUG -std=c++23 -msse2 -fdiagnostics-color -fno-strict-aliasing -fno-exceptions -fvisibility-inlines-hidden -fvisibility=hidden -fomit-frame-pointer -Wall -Wtype-limits -Wsign-compare -Wignored-qualifiers -Wuninitialized -Wshadow -Wshadow-field-in-constructor -Winit-self -Wmissing-declarations-Wmissing-variable-declarations -Werror=format -Wno-trigraphs -MD -MT Source/Core/VideoCommon/CMakeFiles/videocommon.dir/PerformanceMetrics.cpp.o -MF Source/Core/VideoCommon/CMakeFiles/videocommon.dir/PerformanceMetrics.cpp.o.d -o Source/Core/VideoCommon/CMakeFiles/videocommon.dir/PerformanceMetrics.cpp.o -c /dolphin-local/Source/Core/VideoCommon/PerformanceMetrics.cpp
In file included from /dolphin-local/Source/Core/VideoCommon/PerformanceMetrics.cpp:4:
/dolphin-local/Source/Core/VideoCommon/PerformanceMetrics.h:69:51: error: no matching constructor for initialization of 'std::atomic<FrameBufferSize>'
   69 |   std::atomic<FrameBufferSize> m_frame_buffer_size{};
      |                                                   ^~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/atomic:237:17: note: candidate constructor not viable: constraints not satisfied
  237 |       constexpr atomic() noexcept(is_nothrow_default_constructible_v<_Tp>)
      |                 ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/atomic:238:11: note: because 'is_default_constructible_v<PerformanceMetrics::FrameBufferSize>' evaluated to false
  238 |         requires is_default_constructible_v<_Tp>
      |                  ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/atomic:246:7: note: candidate constructor not viable: requires 1 argument, but 0 were provided
  246 |       atomic(const atomic&) = delete;
      |       ^      ~~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/atomic:252:17: note: candidate constructor not viable: requires single argument '__i', but no arguments were provided
  252 |       constexpr atomic(_Tp __i) noexcept : _M_i(__i)
      |                 ^      ~~~~~~~
1 error generated.
```

This was tested and occurs on both Arch and Alpine Linux.
2026-07-13 02:26:49 +02:00
JosJuice aff4d18d59 Move the code for the show internal resolution setting
fb4ff3e put all the code for the show internal resolution setting right
next to the code for the show FPS setting, presumably because an earlier
version of that commit had them next to each other in the GUI. It makes
more conceptual sense to put the code next to the code for the show
statistics settings, matching what the GUI looks like now.
2026-07-05 09:50:13 +02:00
JosJuice 6f72de3579 VideoCommon: Show internal resolution stats below VPS
It looked a bit out of place wedged in between the FPS and VPS.
2026-07-05 09:50:13 +02:00
JosJuice c958dbc46c VideoCommon: Use XFB for internal resolution stats
fb4ff3e added a statistics option to show the internal resolution, but
it just showed the total size of the EFB (which is always 640x528) times
the IR scale, so it didn't convey any useful information.

This commit instead makes the option use the size of the last XFB copy
(not multiplied by the IR scale), which changes based on the game's
rendering resolution.
2026-07-05 09:50:13 +02:00
JosJuice 5f372d6b1d VideoCommon: Reduce padding in PresentInfo
This makes the struct 8 bytes smaller.
2026-07-05 09:50:13 +02:00
DentomologistandGitHub 379a1a7109 Merge pull request #14607 from elyashue/internal-resolution-display
VideoCommon: Added option for showcasing internal resolution
2026-05-25 12:17:29 -07:00
Admiral H. Curtiss afd343ec9c Reimplement custom cropping by adjusting the source aspect ratio 2026-05-24 20:51:23 +02:00
Admiral H. Curtiss ba15ddd602 Revert the Presenter logic changes from #14506 2026-05-24 19:47:18 +02:00
Admiral H. CurtissandGitHub d3217f65c3 Merge pull request #14506 from adamscott/crop-that-screen
Add screen crop feature
2026-05-23 20:53:31 +02:00
Admiral H. Curtiss 17b4b8fc07 Address minor nits in new cropping logic 2026-05-23 19:47:28 +02:00
Dentomologist 34646cb9a9 Replace some [[maybe_unused]] annotations with commented names
Remove the [[maybe_unused]] annotation from various parameters that are
unconditionally unused and comment out their names instead. This makes
it unambiguous that the variables are unused, while making the remaining
[[maybe_unused]] annotations more reliable indicators that those
variables are in fact used in some contexts.

These parameters are mostly in overridden functions where the override
doesn't need that particular variable.
2026-05-03 17:09:59 -07:00
Dentomologist f67d80c7c1 VideoConfig: Rename StereoMode::TAB to StereoMode::TopAndBottom 2026-04-24 11:19:11 -07:00
Dentomologist 655ee270e7 VideoConfig: Rename StereoMode::SBS to StereoMode::SideBySide 2026-04-23 12:32:26 -07:00
Elyas Hue fb4ff3e51b VideoCommon: Added an option to showcase internal resolution, EFB width x height as screen overlay. Option to turn it on is a checkbox in screen on the OSD settings, in debug. This supports enhancements. 2026-04-19 23:19:21 +02:00
JosJuiceandGitHub 74bb80544e Merge pull request #14565 from SuperSamus/cpp-argument-move-reference
Improve usage of std::move and const references parameters
2026-04-18 21:02:30 +02:00
Adam Scott a5059cbca8 Add screen crop feature 2026-04-18 13:08:41 -04:00
cristian64 6059045c59 Core: Address -Wrange-loop-construct warning.
The warning can be seen since 1f72403ec7 when GCC 13.3.0 is used:

```counterexample
[1540/1898] Building CXX object Source/Core/VideoCommon/CMakeFiles/videocommon.dir/TextureCacheBase.cpp.o
/w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp: In member function 'void TextureCacheBase::ApplyMaterialToCacheEntry(const VideoCommon::MaterialResource&, TCacheEntry*)':
/w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp:3136:19: warning: loop variable 'texture' creates a copy from type 'const VideoCommon::MaterialResource::TextureLikeReference' [-Wrange-loop-construct]
 3136 |   for (const auto texture : material_data->GetTextures())
      |                   ^~~~~~~
/w/dolphin/Source/Core/VideoCommon/TextureCacheBase.cpp:3136:19: note: use reference type to prevent copying
 3136 |   for (const auto texture : material_data->GetTextures())
      |                   ^~~~~~~
      |                   &
```
2026-04-18 10:23:55 +01: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
Jordan WoyakandGitHub b62bfe4b30 Merge pull request #14336 from SuperSamus/arbitrary-mipmap-disables-gpu-decoding
VideoCommon: Invert interaction between Arbitrary Mipmap Detection and GPU Texture Decoding (the former disables the latter)
2026-04-12 20:55:22 -05:00
Jordan WoyakandGitHub 33f62b0f9f Merge pull request #14500 from Sintendo/span2
Replace `const std::vector&` arguments with `std::span`
2026-04-11 14:55:41 -05:00
JMC47andGitHub 798f581c38 Merge pull request #14140 from iwubcode/blurry_bloom
VideoCommon: add a graphics mod feature to modify EFBs with a custom material, enhance bloom
2026-04-03 13:38:04 -04:00
OatmealDomeandGitHub 5e95d5e7f5 Merge pull request #14492 from OatmealDome/apple-discard-bug-fixed-3
VideoBackends/Vulkan: Drop BUG_BROKEN_DISCARD_WITH_EARLY_Z workaround
2026-04-02 23:55:16 -04:00
Tillmann Karras 51e488e84a VideoCommon: ignore zero-stride EFB/XFB copies
just clear if requested
2026-03-28 03:05:08 +00:00
iwubcode 6b7a9e6ac3 VideoCommon: allow graphics mods to be added to sub folders 2026-03-26 20:13:16 -05:00
iwubcode 9cde551e29 VideoCommon: watch the user and system graphics mods directories for modified assets 2026-03-26 20:13:16 -05:00
iwubcode 1f72403ec7 VideoCommon: optionally apply materials to EFBs
After an EFB operation is turned into a texture, if there is a graphics mod action that provides a custom material, update the EFB texture with the material
2026-03-26 20:13:16 -05:00
iwubcode 7bfd43eb1a VideoCommon: update CustomPipelineAction to get a Material when an EFB is received 2026-03-26 20:13:16 -05:00
iwubcode 2d8f955851 VideoCommon: enhance 'CustomResourceManager' for post processing
This expands the interface of 'CustomResourceManager' to get a Material for post processing a frame buffer (currently EFB).  The flow is similar to the normal draw material but distinguishes itself by not needing a UID.  The full shader is much simpler than the draw shader and is currently put inline with the shader resource.
2026-03-26 20:13:16 -05:00
iwubcode 6ba2d2e081 VideoCommon: update graphics mod action interface
* Add a 'AfterEFB' function to graphics mod action that can return a Material
* Rename previous EFB graphics mod function to 'BeforeEFB' to differentiate from 'AfterEFB'
* Rename previous XFB graphics mod function to 'BeforeXFB' to mirror EFB
2026-03-26 18:52:01 -05:00
JMC47andGitHub dcbcfed12a Merge pull request #14499 from JosJuice/gpu-desync-no-report
Remove "please report it to the developers" from unknown opcode message
2026-03-25 13:31:55 -04:00
Sintendo f6a67aa6e7 Use more std::span arguments 2026-03-23 23:55:09 +01:00
JosJuice f2055fe0b8 Remove "please report it to the developers" from unknown opcode message
I think we've gotten all the useful reports we can get from this now.
Nowadays we're just getting repeated reports of issues we already know
about, like https://bugs.dolphin-emu.org/issues/12321.
2026-03-22 14:23:46 +01:00
OatmealDome 5a94e63e42 UberShaderPixel: Fix missing check for framebuffer fetch for BUG_BROKEN_DISCARD_WITH_EARLY_Z workaround 2026-03-21 11:16:15 -04:00
OatmealDome 98ca653774 DriverDetails: Mark BUG_BROKEN_DISCARD_WITH_EARLY_Z as fixed in macOS 14.0+ 2026-03-21 11:16:15 -04:00
OatmealDome 750c6ed705 DriverDetails: Use macOS version as the driver version 2026-03-21 11:16:14 -04:00
TellowKrinkle 56845b2b93 VideoCommon: Fix no mips hack 2026-03-21 00:35:06 -05:00
Mihai BrodschiandJordan Woyak f9c3f06f0a Move PerformanceMetrics from global variable to System
This avoids the static initialization order fiasco between Core and VideoCommon

Co-authored-by: Jordan Woyak <jordan.woyak@gmail.com>
2026-03-14 16:42:21 +02:00
Dentomologist 252ec7452c PerformanceMetrics: Use HookableEvent for state changed callback
Use the normal state changed `HookableEvent` instead of having
`Core::NotifyStateChanged` call `g_perf_metrics.OnEmulationStateChanged`
directly.

The direct call was added in bad78cfed4 to
avoid a crash. At the time state changed callbacks were stored in a
vector, and the crash was caused by `g_perf_metric`'s destructor trying
to remove the callback from the already-destroyed vector.

Later a97627e736 switched state changed
callbacks to use `HookableEvent`, which is specifically designed to
handle the case where a hook outlives its associated event.

Since the workaround is no longer necessary replace it with a standard
`EventHook`.
2026-03-07 12:50:59 -08:00
Dentomologist edb576f4c0 VertexLoaderManager: Fix crash caused by invalid array base
Don't set cached array bases to invalid pointers. If a game tries to set
an invalid base just keep the old one, which might cause game problems
but won't crash the emulator.
2026-03-02 13:02:51 -08:00
Martino Fontana fdbc2883ef VideoCommon: Invert interaction between Arbitrary Mipmap Detection and GPU Texture Decoding (the former disables the latter)
Split from #14293.
It makes sense for a setting that changes visual output to have priority over a setting that barely makes any difference.
2026-02-13 13:57:43 +01:00
Dentomologist 0bf34a73b3 PerformanceMetrics: Clamp graph minimum auto size
Add a minimum value for the automatic size of the performance metrics
graph. The graph can still be manually resized smaller than this limit.

This prevents the graph from automatically resizing itself to be too
small to contain the full graph and legend, which happened when using
native resolution with `Auto-Adjust Window Size` enabled.
2026-02-06 13:30:48 -08:00
Dentomologist f7b7267993 PerformanceMetrics: Fix automatic graph resizing
Fix a bug causing the performance graph to not resize when the render
window changed size:
* When changing the render window size during emulation the performance
  graph wouldn't update its size until the next emulation session.
* When changing the render window size with no emulation active (by
  changing the Internal Resolution with Auto-Adjust Window Size enabled)
  the performance graph wouldn't update its size until the second
  emulation session after the change.

Before explaining why the bug happened, here are some details about Dear
ImGui (henceforth ImGui) for context:
* In order to allow programs to specify initial ImGui window sizes while
  also allowing the user to resize them, `SetNextWindowSize` takes a
  flag from the `ImGuiCond_` enum specifying under what circumstances
  that function should actually have any effect.
* ImGuiCond_FirstUseEver causes ImGui to only apply the command when the
  window doesn't have any saved size information for that session or in
  the ini file specified by `ImGui::GetIO().IniFilename`. Since we set
  that filename to `nullptr`, in practice the resize command is applied
  on the first frame of each ImGui/emulation session.
* Qt saves the most recent size of the render window across emulation
  (and even Dolphin) sessions, which is then used to set the initial
  value of `ImGui::GetIO().DisplaySize` in the next emulation session.
* It takes multiple frames for the size of the render window to update
  when changed by setting the internal resolution. This means that
  `ImGui::GetIO().DisplaySize` will have a stale value in the
  intervening frames, and specifically for the first few frames of
  emulation if the resolution was changed beforehand.

When changing the resolution during emulation the call to
`SetNextWindowSize` had no effect because of the
`ImGuiCond_FirstUseEver` flag. `DisplaySize` would be updated several
frames later, and then the next emulation session would update the graph
size on its first frame.

When changing the resolution outside emulation and then starting a game,
the call to SetNextWindowSize on the first frame took effect but used
the stale value of `DisplaySize`. `DisplaySize` would be updated a few
frames later, but the graph wouldn't be resized until the first frame of
the second emulation session.

This commit fixes the issue by using the `ImGuiCond_Always` flag in the
performance graph's call to `SetNextWindowSize` when the render window
size changes.
2026-02-06 13:30:48 -08:00
Dentomologist 4b5b2ebd2f PerformanceMetrics: Add padding below graph
Add vertical padding between the performance graph (when it's enabled)
and the FPS/VPS/Speed overlays.
2026-02-06 13:30:48 -08:00
DentomologistandGitHub 6711d77b99 Merge pull request #14204 from Geotale/update-comment
Update Comments Based On Hardware Test
2026-01-31 15:02:09 -08:00
Martino Fontana a14c88ba67 Remove unused imports
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...)
2026-01-25 16:12:15 +01:00
Sintendo 972ec95cb3 Clean includes 2026-01-24 16:50:10 +01:00
Sintendo f2e1c71803 Common/FileSearch: Refactor DoFileSearch 2026-01-24 16:50:10 +01:00
JosJuice b07c78aabe VideoCommon: Move TextureInfo getters to header
This improves my PC's performance on RS2 Hoth by... 0.1% or so, which I
think is within the margin of error. But this change also cuts down on
boilerplate.
2026-01-19 19:46:21 +01:00
JosJuice fb07406f10 VideoCommon: Defer creating TextureInfo
TextureCacheBase::LoadImpl has a hot path where the passed-in
TextureInfo never gets used. Instead of passing in a TextureInfo, let's
pass in the stage and create the TextureInfo from the stage if needed.

This unlocks somewhere above an additional 4% performance boost in the
Hoth level of Rogue Squadron 2 on my PC. Performance varies, making it
difficult for me to measure, so treat this as a very approximate number.
2026-01-18 13:04:06 +01:00