Commit Graph

40450 Commits

Author SHA1 Message Date
Admiral H. Curtiss dbe6a5f7e4
Merge pull request #11300 from iwubcode/custom-shaders
VideoCommon: add a graphics mod action that allows you to modify the game's base rendering
2023-08-22 02:18:40 +02:00
Dentomologist 58ab94c30c GCC: Suppress PPCSTATE_OFF invalid-offsetof warnings
Modify PPCSTATE_OFF and PPCSTATE_OFF_ARRAY macros when using GCC to
avoid useless log spam. Specifically, use a consteval lambda with gcc
_Pragma statements to disable the -Winvalid-offsetof warning inside the
macros.

Each successful build (and many failing ones) on the Android buildbot
generates almost 300 cases of -Winvalid-offsetof, resulting in thousands
of lines of log spam per build. In addition to bloating the log filesize
these spurious warnings make it harder to find actual warnings.

These warnings are generated by calls to the macros PPCSTATE_OFF and
PPCSTATE_OFF_ARRAY, which in turn are used by many other macros used by
the JIT. The ultimate cause is that offsetof is only conditionally
supported on non-standard-layout types, which includes the PowerPCState
struct.

To address potential questions of whether there's a better way to handle
this:

The obvious solution would be to modify PowerPCState so that it does
have a standard layout. This is unfortunately impractical.

To have a standard layout a type can only contain other types with
standard layouts. None of the stl containers are guaranteed to have
standard layouts, and PowerPCState contains a std::tuple and std::array.
PowerPCState also contains a PowerPC::Cache and InstructionCache which
themselves contain std:arrays and std::vectors.

Furthermore InstructionCache derives from Cache, and a derived class can
only have standard layout if at most one class in its hierarchy has a
non-static data member, but both classes have such members. Making
InstructionCache have a standard layout would require duplicating all
the functionality of Cache so it no longer derived from it, as well as
replacing the stl containers. This might require having a raw pointer to
said containers, with the manual memory management that implies.

All of that would be much more disruptive than would be justified to get
rid of some warnings (however annoying they might be). This is
compounded by the fact that PowerPCState hasn't had a standard layout
for a long time, if ever, and if the PPCSTATE_OFF macros weren't working
reliably it would have become obvious a long time ago.

As to why I picked the lambda solution over other potential changes:

- Keeping the define as-is and wrapping some gcc #pragmas around it
  doesn't work because the pragmas don't get included when the define is
  substituted to the call site.

- Keeping the define as a non-lambda expression and using inline
  _Pragma() statements would ideally be better and works fine for msvc,
  but fails for GCC with "'#pragma' is not allowed here".

- Turning off -Winvalid-offsetof globally for gcc would work, but there
  might be other contexts where offsetof is problematic and GCC seems to
  be the only compiler warning about it.
2023-08-21 14:01:11 -07:00
Sepalani 573863703a MemoryViewWidget: Fix some characters being truncated 2023-08-21 22:02:44 +04:00
JosJuice e7c2133160 Fixes to translatable strings 2023-08-21 16:29:52 +02:00
JosJuice 3451cb1ca2
Merge pull request #11959 from Dentomologist/add_x64emitter_unittests
x64EmitterTest: add J/J_CC/CALL unit tests
2023-08-21 16:27:04 +02:00
iwubcode 5506121685 VideoCommon: add support to graphics mod manager to load in assets and pass it to graphics actions 2023-08-20 18:53:27 -05:00
iwubcode 6ea0d17802 VideoCommon: when graphics settings change, trigger a reload of all custom shaders 2023-08-20 18:53:27 -05:00
iwubcode 931a8aa413 VideoCommon: add milliseconds elapsed time value to pixel shaders as a uniform to be able to support animation effects in custom shaders 2023-08-20 18:53:27 -05:00
iwubcode 675544ec2b docs: Add custom pipeline documentation 2023-08-20 18:53:27 -05:00
iwubcode c7191382be VideoCommon: add custom pipeline action 2023-08-20 18:53:27 -05:00
iwubcode d320366954 VideoCommon: add custom shader cache to VertexManagerBase, supporting custom pixel shaders by replacing the existing pipeline with a modified one 2023-08-20 18:53:27 -05:00
iwubcode bedbf2b8c6 VideoCommon: add custom shader cache 2023-08-20 18:53:27 -05:00
iwubcode dbaf24ef09 VideoCommon: add data needed to support custom pixel shaders to graphics mod actions 2023-08-20 18:53:27 -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
iwubcode c3a370839a VideoCommon: add helper functions to handle generating custom lighting code for a custom pixel shader 2023-08-20 18:53:27 -05:00
iwubcode 0da5cf60a8 VideoCommon: add custom pixel shader definition and custom shader header to shadergen common as it will be used by both the special and uber shader variant of pixel shaders 2023-08-20 18:53:27 -05:00
Admiral H. Curtiss f19651e49b
Merge pull request #11025 from AdmiralCurtiss/hle-printf
HLE_OS: Manually handle printfs from emulated software to prevent emulated software from crashing Dolphin with an invalid printf formatting string.
2023-08-20 01:31:49 +02:00
JosJuice 0f64df3e3e DiscIO: Don't keep volume pointer in DiscScrubber
Keeping the pointer creates use-after-free opportunities, and we don't
have much reason to keep it around anyway.
2023-08-19 17:30:22 +02:00
JosJuice 8c5d8a6322
Merge pull request #12120 from AdmiralCurtiss/jit64-membase
Jit64: Actually update membase register after GlobalAdvance().
2023-08-19 17:20:28 +02:00
Admiral H. Curtiss d36f0fff4c
Jit64: Actually update membase register after GlobalAdvance(). 2023-08-19 17:00:01 +02:00
JosJuice ed7894924c
Merge pull request #12048 from krnlyng/someothertest
Jit: Load the memory register only when the msr bits have changed and do not use jumps to load it.
2023-08-19 09:49:29 +02:00
Admiral H. Curtiss b6bfa10ace
Merge pull request #11996 from Dentomologist/remove_pointless_pauseandlock_functions
EXI: Remove pointless PauseAndLock functions
2023-08-18 21:35:56 +02:00
Admiral H. Curtiss bb4ed1c450
Merge pull request #12118 from AdmiralCurtiss/tas-window-translatable
DolphinQt/TASInputWindow: Make 'Enable Controller Input' translatable.
2023-08-18 21:33:23 +02:00
Admiral H. Curtiss 8a96ce73f6
Merge pull request #12044 from jmlee337/upnpport
Do not try portmapping when using traversal server
2023-08-18 21:28:52 +02:00
Admiral H. Curtiss b3faca5be9
Merge pull request #12113 from Seedonator/master
Dragon Ball Z: Budokai Tenkaichi 3 - Graphics Mod Bloom and HUD Definitions
2023-08-18 21:27:43 +02:00
Admiral H. Curtiss 4ba2724489
Merge pull request #12071 from JosJuice/gametdb-update
Update GameTDB files
2023-08-18 21:27:33 +02:00
Admiral H. Curtiss 9a51215af3
Merge pull request #12083 from JosJuice/android-controlled-by-gamepad
InputConfig: Update IsControllerControlledByGamepadDevice for Android input overhaul
2023-08-18 21:27:26 +02:00
Seedonator 5dc01e6107
Dragon Ball Z: Budokai Tenkaichi 3 - Graphics Mod Bloom and HUD Definitions 2023-08-18 21:08:16 +02:00
xujibbs b3902397cb
DolphinQt/TASInputWindow: Make 'Enable Controller Input' translatable. 2023-08-18 21:02:30 +02:00
Admiral H. Curtiss 3441fe6efc
Merge pull request #11999 from Filoppi/post_process_fixes
Video: implement output resampling (upscaling/downscaling) methods
2023-08-18 20:33:09 +02:00
JosJuice a9ec2a6e41
Merge pull request #12116 from AdmiralCurtiss/log-colors
DolphinQt/LogWidget: Restore log window colors.
2023-08-18 09:00:43 +02:00
Filoppi 80b453082d Video: fix post process shaders with parameters failing to build on OpenGL
This was because the shader uniforms between the pixel and vertex shaders
were willingly left different, to avoid filling the vertex shader with unnecessary
params. Turns out all backends are fine with this except OGL.
The new behaviour is now much more consistent and well explained,
the "default" shaders are the ones that always run, and the non default
ones are the user selected ones (if any).
2023-08-18 02:00:56 +03:00
Filoppi fc3f7866f8 Video: Fix area/box resampling shifting the output by about one pixel when upscaling and downscaling 2023-08-18 02:00:56 +03:00
Sam Belliveau 39d96a21a8 Video: Improved Tooltips & Bicubic (#5)
Edited by Filoppi
2023-08-18 02:00:56 +03:00
Sam Belliveau ca93a5191f Video: Added Box Resampling
Edited by Filoppi
2023-08-18 02:00:56 +03:00
Filoppi 2edf81cdb0 Video: implement output resampling (upscaling/downscaling) methods 2023-08-18 02:00:55 +03:00
Admiral H. Curtiss 1854ff0142
Merge pull request #12003 from Filoppi/auto_hdr
Add AutoHDR post process shader
2023-08-18 00:20:08 +02:00
Admiral H. Curtiss ecf5870a91
Merge pull request #12115 from AdmiralCurtiss/advanced-config
DolphinQt/AdvancedPane: UI improvements.
2023-08-18 00:16:59 +02:00
Admiral H. Curtiss 42e893d6be
Merge pull request #12114 from AdmiralCurtiss/color-correction-button
DolphinQt/EnhancementsWidget: Use custom tooltip for Color Correction button.
2023-08-18 00:16:47 +02:00
Admiral H. Curtiss fc7ef66669
Merge pull request #12110 from JosJuice/android-dir-init-toast
Android: Move DirectoryInitialization toast to UI thread
2023-08-18 00:15:15 +02:00
Admiral H. Curtiss a08792033a
Merge pull request #12103 from iwubcode/asset_load_system_time
VideoCommon: asset load time is now stored as a chrono system_clock time
2023-08-18 00:14:29 +02:00
JosJuice b62c25864f CPUThreadConfigCallback: Remove some CPU thread asserts
Turns out that we have two subsystems that want to register CPU thread
callbacks from a different thread than the CPU thread: FreeLookConfig
and VideoConfig. Both seem to happen from the host thread before the CPU
thread starts, so there's no thread safety issue. But ideally, if we
want to allow registering callbacks from threads other than the CPU
thread, we should make registering callbacks actually thread-safe. This
is an unsolved problem for the regular Config system, so I would like to
leave it outside the scope of this PR.
2023-08-17 19:19:26 +02:00
JosJuice 7197e3abd0 Use structs for config callback IDs
This way you can't mix up regular config callback IDs and CPU thread
config callback IDs. (It would be rather bad if you did!)
2023-08-17 19:19:26 +02:00
JosJuice 1104b93ee4 UnitTests: Declare as CPU thread when using CPUThreadConfigCallback
This fixes a bunch of DEBUG_ASSERTs in the unit tests.
2023-08-17 19:19:25 +02:00
JosJuice 2b17e89336 Config: Don't clear callbacks on shutdown
This fixes a problem that started happening in CoreTimingTest after the
previous commit. CPUThreadConfigCallback registers a Config callback
only once per run of the process, but CoreTimingTest calls
Config::Shutdown after each test, and Config::Shutdown was clearing all
callbacks, preventing the callback from running after that.
2023-08-17 19:19:25 +02:00
JosJuice 71ce8bb6f0 Don't call RunAsCPUThread in config callbacks
In theory, our config system supports calling Set from any thread. But
because we have config callbacks that call RunAsCPUThread, it's a lot
more restricted in practice. Calling Set from any thread other than the
host thread or the CPU thread is formally thread unsafe, and calling Set
on the host thread while the CPU thread is showing a panic alert causes
a deadlock. This is especially a problem because 04072f0 made the
"Ignore for this session" button in panic alerts call Set.

Because so many of our config callbacks want their code to run on the
CPU thread, I thought it would make sense to have a centralized way to
move execution to the CPU thread for config callbacks. To solve the
deadlock problem, this new way is non-blocking. This means that threads
other than the CPU thread might continue executing before the CPU thread
is informed of the new config, but I don't think there's any problem
with that.

Intends to fix https://bugs.dolphin-emu.org/issues/13108.
2023-08-17 19:19:25 +02:00
Admiral H. Curtiss a9cba9be36
DolphinQt/LogWidget: Restore log window colors. 2023-08-16 19:55:18 +02:00
Admiral H. Curtiss a34f221782
Core/PowerPC: Return AvailableCPUCores() as a std::span. 2023-08-16 19:25:03 +02:00
Admiral H. Curtiss 51f807b63a
DolphinQt/AdvancedPane: Update all GUI elements from config in Update(). 2023-08-16 19:25:03 +02:00