Commit Graph

5423 Commits

Author SHA1 Message Date
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
JosJuice
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
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 Woyak
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 Woyak
33f62b0f9f Merge pull request #14500 from Sintendo/span2
Replace `const std::vector&` arguments with `std::span`
2026-04-11 14:55:41 -05:00
JMC47
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
OatmealDome
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
JMC47
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 Brodschi
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
Dentomologist
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
JMC47
035bcffc63 Merge pull request #14289 from Sintendo/typos
Fix various typos and spelling mistakes
2026-01-17 19:10:50 -05:00
iwubcode
b556bd99d7 Merge pull request #14268 from JoshuaVandaele/std-tounderlying
c++23: Replace Common::ToUnderlying with std::to_underlying
2026-01-17 16:49:57 -06:00
Sintendo
1e0473e44f Fix various typos and spelling mistakes 2026-01-17 20:11:38 +01:00
JosJuice
f7b4d2738b VideoCommon: Don't create mipmap vector in TextureInfo
The TextureInfo constructor creates a vector of MipLevels. This could be
good for performance if MipLevels are accessed very often for each
TextureInfo, but that's not the case. Dolphin creates thousands of
TextureInfos per second that it never accesses the mipmap levels of
because there's a hit in the texture cache, and in the uncommon case of
a texture cache miss, the mipmap levels only get looped through once.

To make the common case of texture cache hits as fast as possible, let's
not create a vector in the TextureInfo constructor. This commit
implements a custom iterator for MipLevels instead.

In my testing on the Death Star level of Rogue Squadron 2, this speeds
up TextureInfo::FromStage by 200%, giving an overall emulation speedup
of a bit over 1%. Results on the Hoth level are even better, with
TextureInfo::FromStage being close to 300% faster and overall emulation
being over 4% faster. (Single core, no GPU texture decoding.)
2026-01-17 17:57:07 +01:00
Joshua Vandaële
55f0715ad4 c++23: Replace Common::ToUnderlying with std::to_underlying
Requires at least GCC 11, Clang 13, MSVC 19.30 (VS2022 17.0), or AppleClang 13.1.6 (XCode 13.3).
2026-01-09 23:49:10 +01:00
Joshua Vandaële
f9fe82f19e ShaderAsset: Fix shadowed variable
`samplers` is a member defined in ShaderAsset.h
2025-12-29 11:12:07 +01:00
iwubcode
aa1605e95a Merge pull request #14228 from iwubcode/clear_compiler_work_resource_mgr
VideoCommon: clear all compiler work when resource manager shuts down
2025-12-27 13:09:21 -06:00
JosJuice
db6c3b783c Merge pull request #14234 from JoshuaVandaele/wunused-cpipeline
CustomPipeline: Remove unused functions
2025-12-27 11:17:27 +01:00
JosJuice
73f2ac6eb0 Merge pull request #14233 from Sintendo/fix-shader-resource-warning
VideoCommon: Fix ShaderResource init order warning
2025-12-27 11:16:21 +01:00
Joshua Vandaële
35c6a6e612 CustomPipeline: Remove unused functions 2025-12-27 09:07:42 +01:00
Sintendo
1b3485b6fd VideoCommon: Fix ShaderResource init order warning 2025-12-26 23:15:17 +01:00
iwubcode
66c392f729 VideoCommon: initialize stored viewport to 0, fixes a crash in debug mode for d3d 2025-12-24 15:23:25 -06:00
iwubcode
f846fc0d02 VideoCommon: clear all compiler work when resource manager shuts down 2025-12-24 01:51:55 -06: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