Commit Graph

14468 Commits

Author SHA1 Message Date
skidau 9d9984e96f Merge pull request #1159 from FioraAeterna/blocklinkdebug
JIT: enable block linking and idle skipping in debug mode
2014-09-30 13:24:16 +10:00
skidau 7828ddd542 Merge pull request #1150 from FioraAeterna/extsmerge
JIT: merge lbz + extsb
2014-09-30 13:19:45 +10:00
skidau da221e3d9c Merge pull request #1018 from zhuowei/elf_map_basename_only
When loading the map file for a DOL/ELF file, extract only the filename from the DOL/ELF's path
2014-09-30 13:17:29 +10:00
comex 87a95727cd ReadDataFromFifo is always called with len = 32. Remove the parameter to enable optimizations.
And rename some variables around it to be less confusing.
2014-09-29 22:07:16 -04:00
Lioncash 05a8d9d54a NetPlayClient: Remove unused macro 2014-09-29 08:42:18 -04:00
comex b5ebace92e Merge pull request #1185 from comex/opengl-core-extensions
Add OpenGL 4.0-4.5 core extensions.
2014-09-29 02:22:50 -04:00
comex b8e31c1d3e Add OpenGL 4.0-4.5 core extensions.
This noticeably includes GL_ARB_get_program_binary, which was previously
thought unsupported on OS X.  Well, actually, the OS X implementation is
trivial and reports 0 binary formats (as of 10.10; this is hardcoded in
GLEngine, by the way), but at least it'll work if it's fixed someday.
2014-09-29 00:36:45 -04:00
comex 4c031bed4b Merge pull request #1179 from lioncash/casts
Jit_Integer: Get rid of some cast noise in boolX
2014-09-28 23:58:09 -04:00
skidau 8ae2152093 Merge pull request #1168 from lioncash/unique
CoreParameter: Use unique_ptrs over raw pointers.
2014-09-29 13:55:00 +10:00
skidau 007ba13cfa Merge pull request #1144 from skidau/fifo-linked
Moved the linking of the FIFO CPWritePointer near where CPWritePointer gets updated
2014-09-29 13:52:33 +10:00
skidau c7f3858379 Merge pull request #1138 from FioraAeterna/arithetweak
JIT: a small optimization for subfex and friends
2014-09-29 13:51:44 +10:00
Lioncash d13383c4e6 Merge pull request #1181 from FioraAeterna/debuggqr
GekkoDisassembler: show W and I in psq_l/psq_st disassembly
2014-09-28 23:45:49 -04:00
comex fbabc03b3f Merge pull request #885 from comex/gpu-determinism
GPU determinism (apparently it is ready for merge)
2014-09-28 21:59:27 -04:00
comex 6c0a68d507 Add the override config option.
I hate the config code, but now is not the time to fix it...
2014-09-28 21:34:31 -04:00
comex 3a2048ea57 Add a central variable g_want_determinism which controls whether to try to make things deterministic.
It now affects the GPU determinism mode as well as some miscellaneous
things that were calling IsNetPlayRunning.  Probably incomplete.

Notably, this can change while paused, if the user starts recording a
movie.  The movie code appears to have been missing locking between
setting g_playMode and doing other things, which probably had a small
chance of causing crashes or even desynced movies; fix that with
PauseAndLock.

The next commit will add a hidden config variable to override GPU
determinism mode.
2014-09-28 21:34:31 -04:00
comex 65af90669b Add the 'desynced GPU thread' mode.
It's a relatively big commit (less big with -w), but it's hard to test
any of this separately...

The basic problem is that in netplay or movies, the state of the CPU
must be deterministic, including when the game receives notification
that the GPU has processed FIFO data.  Dual core mode notifies the game
whenever the GPU thread actually gets around to doing the work, so it
isn't deterministic.  Single core mode is because it notifies the game
'instantly' (after processing the data synchronously), but it's too slow
for many systems and games.

My old dc-netplay branch worked as follows: everything worked as normal
except the state of the CP registers was a lie, and the CPU thread only
delivered results when idle detection triggered (waiting for the GPU if
they weren't ready at that point).  Usually, a game is idle iff all the
work for the frame has been done, except for a small amount of work
depending on the GPU result, so neither the CPU or the GPU waiting on
the other affected performance much.  However, it's possible that the
game could be waiting for some earlier interrupt, and any of several
games which, for whatever reason, never went into a detectable idle
(even when I tried to improve the detection) would never receive results
at all.  (The current method should have better compatibility, but it
also has slightly higher overhead and breaks some other things, so I
want to reimplement this, hopefully with less impact on the code, in the
future.)

With this commit, the basic idea is that the CPU thread acts as if the
work has been done instantly, like single core mode, but actually hands
it off asynchronously to the GPU thread (after backing up some data that
the game might change in memory before it's actually done).  Since the
work isn't done, any feedback from the GPU to the CPU, such as real
XFB/EFB copies (virtual are OK), EFB pokes, performance queries, etc. is
broken; but most games work with these options disabled, and there is no
need to try to detect what the CPU thread is doing.

Technically: when the flag g_use_deterministic_gpu_thread (currently
stuck on) is on, the CPU thread calls RunGpu like in single core mode.
This function synchronously copies the data from the FIFO to the
internal video buffer and updates the CP registers, interrupts, etc.
However, instead of the regular ReadDataFromFifo followed by running the
opcode decoder, it runs ReadDataFromFifoOnCPU ->
OpcodeDecoder_Preprocess, which relatively quickly scans through the
FIFO data, detects SetFinish calls etc., which are immediately fired,
and saves certain associated data from memory (e.g. display lists) in
AuxBuffers (a parallel stream to the main FIFO, which is a bit slow at
the moment), before handing the data off to the GPU thread to actually
render.  That makes up the bulk of this commit.

In various circumstances, including the aforementioned EFB pokes and
performance queries as well as swap requests (i.e. the end of a frame -
we don't want the CPU potentially pumping out frames too quickly and the
GPU falling behind*), SyncGPU is called to wait for actual completion.

The overhead mainly comes from OpcodeDecoder_Preprocess (which is,
again, synchronous), as well as the actual copying.

Currently, display lists and such are escrowed from main memory even
though they usually won't change over the course of a frame, and
textures are not even though they might, resulting in a small chance of
graphical glitches.  When the texture locking (i.e. fault on write) code
lands, I can make this all correct and maybe a little faster.

* This suggests an alternate determinism method of just delaying results
until a short time before the end of each frame.  For all I know this
might mostly work - I haven't tried it - but if any significant work
hinges on the competion of render to texture etc., the frame will be
missed.
2014-09-28 21:34:29 -04:00
comex 2d4b7c5900 Make ReadDataFromFifo static. 2014-09-28 21:25:12 -04:00
comex 0ae9e398c8 Rejigger some FIFO buffer variables to be more rational.
videoBuffer -> s_video_buffer
size -> s_video_buffer_write_ptr
g_pVideoData -> g_video_buffer_read_ptr (impl moved to Fifo.cpp)

This eradicates the wonderful use of 'size' as a global name, and makes
it clear that s_video_buffer_write_ptr and g_video_buffer_read_ptr are
the two ends of the FIFO buffer s_video_buffer.

Oh, and remove a useless namespace {}.
2014-09-28 21:25:12 -04:00
comex e86ddacb18 Changes to allow LoadCPReg to work in a preprocess mode which affects a separate state.
This state will be used to calculate sizes for skipping over commands on
a separate thread.  An alternative to having these state variables would
be to have the preprocessor stash "state as we go" somewhere, but I
think that would be much uglier.

GetVertexSize now takes an extra argument to determine which state to
use, as does FifoCommandRunnable, which calls it.  While I'm modifying
FifoCommandRunnable, I also change it to take a buffer and size as
parameters rather than using g_pVideoData, which will also be necessary
later.  I also get rid of an unused overload.
2014-09-28 21:25:06 -04:00
comex f0131c2e09 Mechanical changes to move most CP state to a struct rather than separate globals.
The next commit will add a separate copy of the struct and the ability
for LoadCPReg to work on it.
2014-09-28 21:23:29 -04:00
comex 90638c6806 Switch to an unordered_map as a micro-optimization. 2014-09-28 21:23:29 -04:00
comex f8452ff501 Fix threading issue with vertex loader JIT.
VertexLoader::VertexLoader was setting loop_counter, a *static*
variable, to 0.  This was nonsensical, but harmless until I started to
run it on a separate thread, where it had a chance of interfering with a
running vertex translator.

Switch to just using a register for the loop counter.
2014-09-28 21:23:28 -04:00
comex 63c62b277d Some changes to VertexLoaderManager:
- Lazily create the native vertex format (which involves GL calls) from
RunVertices rather than RefreshLoader itself, freeing the latter to be
run from the CPU thread (hopefully).

- In order to avoid useless allocations while doing so, store the native
format inside the VertexLoader rather than using a cache entry.

- Wrap the s_vertex_loader_map in a lock, for similar reasons.
2014-09-28 21:23:28 -04:00
Fiora c102fed36a GekkoDisassembler: show W and I in psq_l/psq_st disassembly 2014-09-28 17:01:35 -07:00
Steven Vascellaro 8e733d755d Removed Project M .ini files 2014-09-28 19:56:21 -04:00
Steven Vascellaro b956be20e3 Replaced generalized instances of GCM with ISO
Renamed various commands to refer to ISO instead of GCM for consistency,
as the commands are used for both Wii and GameCube files.

CompressGCM --> CompressISO
DeleteGCM --> DeleteISO
MultiCompressGCM --> MultiCompressISO
MultiDecompressGCM --> MultiDecompressISO
SetDefaultGCM --> SetDefaultISO

Fixed COMPRESSISO

Fixed missing "COMPRESSISO"

Fixed more COMPRESSISO

Final fix for COMPRESSISO
2014-09-28 19:53:05 -04:00
Steven Vascellaro b73bab223a Changes to Rhythm Heaven Fever
Removed overrides for Idle Frame Skipping and EFB Access.
2014-09-28 16:50:26 -04:00
Steven Vascellaro 466714d446 Settings files
Added settings file for 2 Fast 4 Gnomz [W24EQU]
2014-09-28 16:33:10 -04:00
Lioncash 7e825fdca5 Jit_Integer: Get rid of some cast noise in boolX 2014-09-28 13:28:16 -04:00
Steven Vascellaro 7e110dd2e0 Game Settings Files
Added Dokapon Kingdom [R2DEEB]
2014-09-28 13:06:26 -04:00
Steven Vascellaro 254ef9827c More Game Settings Files
Added settings files for Project M and Project M WiFi
2014-09-28 12:33:25 -04:00
Steven Vascellaro 18cb7865f9 Added .ini file for Rhythm Heaven Fever
Added missing .ini file for SOME01
2014-09-28 12:24:15 -04:00
shuffle2 431fb4d82a Merge pull request #1172 from shuffle2/qt-build-spaces
Fix QtCompile.props to work if the repo path contains spaces.
2014-09-28 02:50:22 -07:00
Lioncash ab639b41ab DSPJitRegCache: Use std::array to represent the register arrays 2014-09-28 03:02:29 -04:00
Shawn Hoffman 9fe2d45ad4 Fix QtCompile.props to work if the repo path contains spaces. 2014-09-27 23:08:18 -07:00
Lioncash ee076453ce Merge pull request #1171 from lioncash/loop
DSPJitRegCache: Merge two loops in popRegs.
2014-09-28 02:07:44 -04:00
skidau 8085af8a2d Merge pull request #1175 from skidau/cleanup-dsparamaddr
Clean-up the leftover dspARAMAddresses code that was no longer needed.
2014-09-28 15:40:53 +10:00
skidau 6bea53ab11 Clean-up the leftover dspARAMAddresses code that was no longer needed. 2014-09-28 15:38:35 +10:00
skidau baeca3e03b Merge pull request #1170 from lioncash/bounds
SI: Fix bounds check in GetDeviceType
2014-09-28 14:57:38 +10:00
skidau 275226c2b6 Merge pull request #1147 from RachelBryk/unicode-tex
Allow custom textures to load from unicode paths.
2014-09-28 14:54:56 +10:00
skidau afccf2276d Merge pull request #1012 from skidau/aram-dma-exceptions
Compile the ARAM DMA exception checks into the JIT block
2014-09-28 14:48:38 +10:00
Lioncash 5b21818c81 Merge pull request #1173 from FioraAeterna/removeprintf
Interpreter: remove debug printf in psq_l
2014-09-27 23:46:31 -04:00
Fiora 3878187721 Interpreter: remove debug printf in psq_l 2014-09-27 20:44:45 -07:00
skidau 7184019090 Increased the savestate internal version.
Added a small note for instant dma.
2014-09-28 11:51:14 +10:00
Lioncash 8b578c7ba3 DSPJitRegCache: Merge two loops in popRegs. 2014-09-27 18:33:48 -04:00
Lioncash 1c42fd9928 SI: Fix bounds check in GetDeviceType 2014-09-27 16:44:21 -04:00
Lioncash a8d8c9230b CoreParameter: Kill off an snprintf usage 2014-09-27 14:45:03 -04:00
Lioncash 2f4d3961b3 CoreParameter: Use unique_ptr in place of raw pointers 2014-09-27 14:42:59 -04:00
skidau 86b6dfe4b3 Added a instant ARAM DMA mode which is enabled automatically when required.
Detects a situation where the game is writing to the dcache at the address being DMA'd. As we do not have dcache emulation, invalid data is being DMA'd causing audio glitches. The following code detects this and enables the DMA to complete instantly before the invalid data is written.
Added accurate ARAM DMA transfer timing.
Removed the addition of DSP exception checking.
2014-09-27 20:47:29 +10:00
skidau 4b37fdfa45 Added a CompileExceptionCheck function to the JitInterface and re-routed the existing code to utilise the interface. 2014-09-27 20:16:26 +10:00