Commit Graph

5153 Commits

Author SHA1 Message Date
JMC47 05e3a52de0
Merge pull request #13135 from Tilka/warning
VideoCommon: fix -Wshadow-uncaptured-local warning and simplify
2024-10-19 15:12:25 -04:00
Tilka fed8220c39
Merge pull request #12712 from Dentomologist/remove_defined_out_code
Remove defined-out code
2024-10-19 19:36:19 +01:00
JMC47 21f4319302
Merge pull request #13092 from mitaclaw/ranges-modernization-3-spaceship
Ranges Algorithms Modernization - Compare
2024-10-17 13:37:16 -04:00
Tillmann Karras 0e41adb7b7 VideoCommon: fix -Wshadow-uncaptured-local warning and simplify 2024-10-16 18:36:00 +01:00
JosJuice 07605bf67c
Merge pull request #13090 from mitaclaw/ranges-modernization-1-trivial
Ranges Algorithms Modernization - Trivial
2024-10-15 17:08:55 +02:00
JMC47 ef8b753cd7
Merge pull request #13115 from Tilka/syncfifo
VideoCommon: fix common opcode decoding errors
2024-10-14 21:26:08 -04:00
Pokechu22 937bb2aa2e Cache normals in addition to binormals and tangents
Fixes LIT (https://bugs.dolphin-emu.org/issues/13635). The text does not include normals, but has lighting enabled. With the previous default of (0, 0, 0), lighting was always black (as dot(X, (0, 0, 0)) is always 0). It seems like the normal from the map in the background (0, 0, 1) is re-used.

LIT also has the vertex color enabled while vertex color is not specified, the same as SMS's debug cubes; the default MissingColorValue GameINI value of solid white seems to work correctly in this case.
2024-10-12 10:32:41 -07:00
Tilka c1832d17f6
Merge pull request #13117 from mitaclaw/ranges-modernization-9-trivial-find
Ranges Algorithms Modernization - Find
2024-10-11 20:27:18 +01:00
mitaclaw 8b1975ab18 GraphicsMod: Simplify `std::sort` using ranges and projections 2024-10-11 12:08:22 -07:00
mitaclaw e8d5fb89e4 C++20: Synthesize `operator!=` From `operator==`
The inequality operator is automatically generated by the compiler if `operator==` is defined.
2024-10-10 20:23:55 -07:00
mitaclaw e4fb837f4b Modernize `std::find_if` with ranges
In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile.
2024-10-10 15:28:11 -07:00
mitaclaw 6ca7e2856b Modernize `std::find` with ranges 2024-10-10 15:28:11 -07:00
mitaclaw 728663bdc0 Modernize `std::binary_search` with ranges
In VolumeVerifier.cpp, constructing a `std::string_view` of the volume's GameID is unnecessary, as `std::`(`ranges::`)`binary_search` supports heterogeneous lookup. The usage in GameFile.cpp is a perfect example.
2024-10-10 00:53:48 -07:00
mitaclaw ebf7cebc32 Modernize `std::sort` with ranges 2024-10-10 00:53:48 -07:00
mitaclaw 9bd1dae41d Modernize `std::fill` with ranges
In DSPCore.cpp, there were two `std::fill` uses that could be simplified using `std::fill_n`. Due to their proximity with other `std::fill` algorithms being modernized with ranges, I chose to make these examples into the rare `std::ranges::fill_n`.
2024-10-10 00:53:48 -07:00
Tillmann Karras e96960e2a6 VideoCommon: fix common opcode decoding errors
Many games call GXSetGPFifo() without first waiting for the GP to finish
consuming outstanding commands in the previous GP fifo. Normally,
Dolphin runs OpcodeDecoding in 1000-cycle time slices. In that time
frame, GXSetGPFifo() has probably completed and the GP read pointer now
points to entirely new memory. If the last GP fifo copy ended in an
incomplete command, the new GP fifo would most likely desync for a
while. To avoid all this, give the GP a time slice right now to copy the
remaining data from the previous GP fifo.
2024-10-10 04:07:44 +01:00
Pokechu22 929bcbdde9 Fifo analyzer: Fix indexed XF loads showing "bytes" instead of "words"
Indexed XF loads specify the number of 32-bit words (generally floats, but light data has some integers) to load, not the number of bytes. This was only a mistake in the fifo analyzer text; the actual implementation already loaded words.
2024-10-06 21:56:48 -07:00
JMC47 339f9311fb
Merge pull request #12918 from JosJuice/revert-revert-audit-get-state
Partially revert "Revert "Audit uses of IsRunning and GetState""
2024-10-06 11:26:06 -04:00
Jules Blok b191c0f7d8
Merge pull request #12208 from PatrickFerry/add-vertex-depth-range-case
Use Vertex Depth Range when zRange Exceeds farZ
2024-10-05 14:14:11 +02:00
JosJuice 6ca2da53e8 Partially revert "Revert "Audit uses of IsRunning and GetState""
This reverts the revert commit bc67fc97c3,
except for the changes in BaseConfigLoader.cpp, which caused the bug
that made us revert 72cf2bdb87. PR 12917
contains an improved change to BaseConfigLoader.cpp, which can be merged
(or rejected) independently.

A few changes have also been made based on review comments.
2024-10-04 18:35:41 +02:00
JosJuice 2da3e49b1e
Merge pull request #13078 from Dentomologist/videobackendbase_only_populate_backend_info_when_uninitialized
VideoBackendBase: Only populate backend info when uninitialized
2024-10-04 18:31:06 +02:00
JMC47 e259831bcf
Merge pull request #13087 from TellowKrinkle/PresentSkip
VideoBackends:Vulkan: Prevent freezes during window resize on Linux
2024-10-02 21:09:25 -04:00
TellowKrinkle 7e1a9490c0 VideoBackends:Vulkan: Don't try to present if swapchain acquire failed 2024-10-02 19:22:16 -05:00
TellowKrinkle fd94ff252d VideoCommon: Dirty pixel shader manager on efb scale changes 2024-09-30 01:12:55 -05:00
Dentomologist dc1b961c09 VideoBackendBase: Only populate backend info when uninitialized
Prevent potential issues when creating the Graphics window (and thus
calling PopulateBackendInfo) while the core state is Stopping, like we
already do while it's Starting or Running.
2024-09-27 12:20:48 -07:00
Dentomologist 0a1084fad5 VideoBackendBase: Check Core state in PopulateBackendInfo
Remove the PopulateBackendInfoFromUI function, which had a single caller
(GraphicsWindow::OnBackendChanged) and checked that the core wasn't
running or starting before calling PopulateBackendInfo.

Move the core state check into PopulateBackendInfo and have
OnBackendChanged call that instead. This guarantees the check is
performed by all callers of PopulateBackendInfo, preventing
potential reintroduction of the crash fixed in 3d4ae63f if another call
to PopulateBackendInfo is added.

As of the previous commit the only other caller of PopulateBackendInfo
is Core::Init shortly before s_state is set to Starting, so it will
always pass the check and so maintain its current behavior.
2024-09-26 17:12:26 -07:00
Dentomologist 91f7b776ca GraphicsWindow: Fix crash when opening during emulation startup
Fix a crash when opening the Graphics window for the first time during
emulation startup when the backend is Vulkan, D3D11, or D3D12.

Don't call PopulateBackendInfo() from the Host thread when the core is
starting up. First, the function has already been called in Core::Init()
so we don't need to again. More importantly, PopulateBackendInfo() calls
g_video_backend->InitBackendInfo(), and the Vulkan and D3D
implementations of those functions load and then unload libraries (and
their associated function pointers) which are potentially in use by
other threads.

This crash was reliably reproducible with the following steps:
1) Select an affected backend.
2) Enable "Compile Shaders Before Starting"
3) Delete the cached shaders (but not the .uidcache file) for the game
   you're testing.
4) Close and reopen Dolphin.
5) Start the game.
6) While the game is still booting or compiling shaders, open the
   Graphics window for the first time in that Dolphin session.

Fixes https://bugs.dolphin-emu.org/issues/13634.
2024-09-26 17:12:26 -07:00
Dentomologist c3d6d2189a Texture Dumping: Show OSD message on startup and when toggled
If texture dumping is enabled, notify the user on emulation startup
using an On Screen Display message.

Also notify the user when texture dumping is toggled.

Addresses https://bugs.dolphin-emu.org/issues/12445.
2024-09-06 13:00:25 -07:00
Admiral H. Curtiss e1b1e4b4cf
Merge pull request #13031 from parona-source/libfmt-11
Add support for libfmt-11
2024-08-31 15:34:48 +02:00
Alfred Wingate d7c93d87be
Add support for libfmt-11
fmt::join was moved into fmt/ranges.h

Signed-off-by: Alfred Wingate <parona@protonmail.com>
2024-08-22 16:54:35 +03:00
Bryan Jacobs 7ec6d116e8 Graphics: Adapt aspect ratio when SBS/TAB 3D is used
Adds support for choosing to present the full resolution
independently to each eye when using side-by-side or
top-and-bottom 3D.
2024-08-22 07:11:43 +10:00
Dr. Dystopia 9602f36248 Remove redundant semicolons 2024-08-20 14:59:54 +02:00
Tillmann Karras 20f4643c74 VideoCommon: force 32-byte alignment for display list address and size 2024-08-18 05:00:38 +01:00
mitaclaw 9fa4eb9aab Use 'contains' method 2024-08-15 14:20:16 -07:00
Dr. Dystopia 618b41a459 Use 'contains' method 2024-08-14 22:18:28 +02:00
Dentomologist d627b78c46 Adjust order and spacing of various #includes
Move some #includes around to match the Contributing guidelines.
2024-07-26 14:28:34 -07:00
TellowKrinkle cab6e7c12e Properly link against xxhash
Things using dolphin_find_optional_system_library need to link against the name used there or they won't work with both the system and bundled cases
2024-07-06 16:56:44 -05:00
iwubcode 36ccbbc06e VideoCommon: add ability to serialize a texture asset metadata to json 2024-06-29 14:50:40 -05:00
iwubcode 1c3402502b VideoCommon: set individual texture asset filter/wrap values when loading from json 2024-06-29 14:50:40 -05:00
iwubcode 75a0a1ed67 VideoCommon: update texture asset to properly set near sampler state value 2024-06-29 14:50:40 -05:00
Admiral H. Curtiss ce2f4101f3
Core/VideoCommon: Revert change from #12828
This causes Dual Core to lock up during the boot sequence, because it tries to wait for a not-yet-running GPU thread.

Fixes https://bugs.dolphin-emu.org/issues/13559
2024-06-23 03:44:05 +02:00
Admiral H. Curtiss 9b33b777cf
Merge pull request #12828 from JosJuice/unify-state-variables-2
Clean up Core::GetState
2024-06-22 20:20:54 +02:00
JosJuice 72cf2bdb87 Audit uses of IsRunning and GetState
Some pieces of code are calling IsRunning because there's some
particular action that only makes sense when emulation is running, for
instance showing the state of the emulated CPU. IsRunning is appropriate
to use for this. Then there are pieces of code that are calling
IsRunning because there's some particular thing they must avoid doing
e.g. when the CPU thread is running or IOS is running. IsRunning isn't
quite appropriate for this. Such code should also be checking for the
states Starting and Stopping. Keep in mind that:

* When the state is Starting, the state can asynchronously change to
  Running at any time.
* When we try to stop the core, the state gets set to Stopping before we
  take any action to actually stop things.

This commit adds a new method Core::IsUninitialized, and changes all
callers of IsRunning and GetState that look to me like they should be
changed.
2024-06-21 20:52:55 +02:00
JosJuice 962230f91e Core: Store current state in less places
Core::GetState reads from four different pieces of state: s_is_stopping,
s_hardware_initialized, s_is_booting, and CPUManager::IsStepping.
I'm keeping that last one as is for now because there's code in Dolphin
that sets it directly, but we can unify the other three to make things
easier to reason about.

This commit also gets rid of s_is_started. This was previously used in
Core::IsRunningAndStarted to ensure true wouldn't be returned until the
CPU thread was started, but it wasn't used in Core::GetState, so
Core::GetState would happily return State::Running after we had
initialized the hardware but before we had initialized the CPU thread.
As far as I know, there are no callers that have any real need to know
whether the boot process is currently initializing the hardware or the
CPU thread. Perhaps once upon a time there was a desire to make the
apploader debuggable, but a long time has passed without anyone stepping
up to implement it, and the way CBoot::RunApploader is implemented makes
it rather difficult. So this commit makes all the functions in Core.cpp
consider the core to still be starting until the CPU thread is started.
2024-06-21 20:46:44 +02:00
Admiral H. Curtiss 5728ebf7ad
Merge pull request #12867 from AdmiralCurtiss/uicommon-dependency
CMake dependency fixes
2024-06-21 20:01:44 +02:00
LillyJadeKatrin 45563a872c Scale challenge icons based on screen height 2024-06-19 13:59:59 -04:00
JMC47 9886199cb1
Merge pull request #12859 from LillyJadeKatrin/retroachievements-challenge-hide
Hide Challenge Icons when OSD Messages Disabled
2024-06-19 02:29:08 -04:00
LillyJadeKatrin 9e1f5ed4b5 Stack Challenge Icons Horizontally 2024-06-15 22:42:40 -04:00
LillyJadeKatrin a79f428972 Fix margins on icon-only messages
Messages with an icon and no text (such as in the game start sequence) had an oversized margin due to ImGui adding padding for an empty string.
2024-06-15 22:42:35 -04:00
LillyJadeKatrin 1b00b4e3d8 OSD messages display horizontally
OSD messages with an icon and text will display the text to the right of the icon instead of below it.
2024-06-15 22:30:39 -04:00