Commit Graph

100 Commits

Author SHA1 Message Date
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
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
mitaclaw 0df401b164 Core::IsRunning: Avoid Global System Accessor 2024-05-01 08:54:17 -07:00
JosJuice 3cfa233b63 VideoCommon: Use GetSpanForAddress safely in texture decoding
Now only VertexLoader remains... But that one might be tricky.
2024-04-20 18:31:08 +02:00
Jordan Woyak ac5c2d9bf2 VideoCommon: Prefer D3D11/12 over OpenGL on Windows. 2024-03-15 19:51:04 -05:00
Admiral H. Curtiss ac670d99e2
VideoCommon: Only initialize Bounding Box if supported by GPU/driver. 2024-01-20 12:34:24 +01:00
Lioncache e539dbba4c VideoCommon/PixelEngine: Passthrough system instance in constructor
Simplifies the interface in terms of usage
2023-12-22 14:19:26 -05:00
Lioncache f97b2d472a VideoCommon/CommandProcessor: Pass system instance through constructor
Makes the use of the interface a little less noisy, especially given
how much of the interface depends on an instance being present.
2023-12-20 09:02:53 -05:00
Lioncache b0d244b772 VideoCommon/Fifo: Pass system instance through FifoManager constructor
Given how many member functions make use of the system instance,
it's likely just better to pass the system instance in on construction.

Makes the interface a little less noisy to use.
2023-12-18 22:03:25 -05:00
iwubcode 849a0c13b5 VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
Sketch fb852a5062 VideoCommon: Deinit Graphics Mod Manager implicitly 2023-09-03 16:06:08 -04:00
Pokechu22 c63f0f37cd VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
Pokechu22 810eb70f0e DolphinAnalytics: Add READS_BOUNDING_BOX game quirk 2023-05-06 17:18:17 -07:00
Josh cd38ed76e2
Keep Vulkan precedence over OpenGL 2023-02-15 12:22:56 -06:00
Josh 546a016dc8
VideoBackend: Make Metal Default on MacOS 2023-02-15 12:05:54 -06:00
Scott Mansell e2de281897 Make sure pixel shaders pick up Initial EFB Scale 2023-02-09 18:36:20 +13:00
Scott Mansell 9b5397abdb Move WidescreenHeuristic to it's own class
It's about the only thing left in renderer
2023-02-09 18:36:20 +13:00
Scott Mansell abfc75f362 Cleanup headers 2023-01-31 19:41:24 +13:00
Scott Mansell ca5ec13e13 Move GraphicsMod out of RenderBase 2023-01-31 19:41:24 +13:00
Scott Mansell 99d3e489ea Move BoundingBox out of RenderBase
They were essentially just pass-though methods
2023-01-31 19:41:24 +13:00
Scott Mansell 8bc8e43dd6 Add virtual Initialize() to PerfQueryBase
Both DX12 and Vulkan already had one.
2023-01-31 19:41:24 +13:00
Scott Mansell 2a2014af09 Implement AbstractGfx for Vulkan 2023-01-31 19:41:23 +13:00
Scott Mansell 58b70b2fb2 Don't set common globals from Video Backends 2023-01-31 19:41:23 +13:00
Scott Mansell f0336a3129 Implement AbstractGfx for OpenGL
Mostly involves moving contents of OGLRender
to OGLGfx and OGLConfig
2023-01-31 18:46:04 +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
Scott Mansell 606c18210d TextureCache: Refactor with smart pointers
The whole ownership model was getting a bit of a mess, with a some
of special cases to deal with. And I'm planning to make it even more
complex in the future.
So here is some upfront work to convert it over to reference counted
pointers.
2023-01-31 18:29:47 +13:00
Admiral H. Curtiss cb0a603c72
VideoCommon: De-globalize GeometryShaderManager class. 2022-12-29 15:33:19 +01:00
Admiral H. Curtiss 50625728e0
VideoCommon: De-globalize VertexShaderManager class. 2022-12-28 15:52:29 +01:00
Admiral H. Curtiss 725bd64ec2
VideoCommon: De-globalize PixelShaderManager class. 2022-12-27 20:13:24 +01:00
Admiral H. Curtiss c486baffe6
VideoCommon/PixelEngine: Pass Core::System to methods. 2022-12-11 21:57:30 +01:00
Admiral H. Curtiss ec8aaf1f30
VideoCommon/PixelEngine: Refactor to class, move to Core::System. 2022-12-11 21:57:19 +01:00
Admiral H. Curtiss ceae4242fc
VideoCommon/Fifo: Pass Core::System to methods. 2022-12-10 17:16:26 +01:00
Admiral H. Curtiss 5624dd6d39
VideoCommon/Fifo: Refactor to class, move to Core::System. 2022-12-10 17:16:19 +01:00
Admiral H. Curtiss 6941d2e7e6
VideoCommon/CommandProcessor: Refactor to class, move to Core::System. 2022-11-29 08:15:01 +01:00
TellowKrinkle 3912fa7a2e VideoCommon: Add reasons for disabled VS expand 2022-10-22 20:18:02 -05:00
Josh ef13a54b0a
VideoBackends - Enable Metal without Vulkan 2022-09-19 11:28:34 -05:00
TellowKrinkle 716c0980d7 VideoBackends: Add Metal renderer 2022-07-21 20:44:19 -05:00
TellowKrinkle f83015649c VideoCommon: Clear backend_info before populating 2022-07-13 02:55:54 -05:00
OatmealDome 6e2febd404 VideoBackendBase: Remove __builtin_available for macOS 10.14 2022-06-01 22:57:51 -04:00
Pokechu22 3949698acf Verify graphics config validity after populating the backend info
... and refresh the config before populating the backend info, as the config (specifically iAdapter) needs to be set to correctly populate the backend info.

Before, the list of valid antialiasing modes was always determined from the first adapter on the list on startup, regardless of the adapter the user selected.
2022-05-16 16:59:57 -07:00
Pokechu22 8d7eff2a8a VideoCommon: Move logging/seen check for unknown opcodes into CommandProcessor
That way, they're in the same place the panic alerts are generated.
2022-01-22 22:04:15 -08:00
Admiral H. Curtiss d8825f5635
Config: Port dual core setting to new config system. 2022-01-09 21:29:11 +01:00
Scott Mansell a33cf27885 TMEM: Handle savestate and init 2021-10-12 15:51:24 +13:00
Techjar 797d0b7b1b VI: Implement post-scanout XFB output
This adds about a frame of latency, and since most games don't change
VI registers during scanout, we can get away with outputting the XFB at
the start of scanout. WWE Crush Hour is the (only currently known)
exception, which has flickering problems when doing it this way.

This adds a path to perform the output at the end of scanout, and gates
it behind an option which defaults to using the latency-reducing
pre-scanout path.
2021-08-03 23:37:50 -04:00
OatmealDome 46e331d000 VideoBackendBase: Prefer Vulkan over OGL on macOS Mojave and newer 2021-07-25 19:21:06 -04:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00