summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/MainBase.cpp
AgeCommit message (Collapse)Author
2015-06-08Fifo: Rewrite SyncGpudegasus
The new implementation has 3 options: SyncGpuMaxDistance SyncGpuMinDistance SyncGpuOverclock The MaxDistance controlls how many CPU cycles the CPU is allowed to be in front of the GPU. Too low values will slow down extremly, too high values are as unsynchronized and half of the games will crash. The -MinDistance (negative) set how many cycles the GPU is allowed to be in front of the CPU. As we are used to emulate an infinitiv fast GPU, this may be set to any high (negative) number. The last parameter is to hack a faster (>1.0) or slower(<1.0) GPU. As we don't emulate GPU timing very well (eg skip the timings of the pixel stage completely), an overclock factor of ~0.5 is often much more accurate than 1.0
2015-05-29Fix invalid pointer errors in Burnout 2.Scott Mansell
Yet another story of games loading weird shit into registers. For some reason, Burnout 2 would (in rare situations) load invalid addresses into cp_state.array_bases. What would the real hardware do in this situation? Who knows, Burnout 2 doesn't actually enable the vertex array with the invalid address so nothing kinky happens. But dolphin tries to optimise things and starts using the address as soon as it is loaded into memory. This causes GetPointer (which is now much more vocal) to throw an error. The Fix: We don't call GetPointer until we are sure the vertex array has been enabled.
2015-05-25Merge pull request #2274 from degasus/disable_bboxRyan Houdek
Disable bbox
2015-05-25Add missing license headersTillmann Karras
2015-05-25VideoCommon: Warn if bbox is disabled but useddegasus
2015-05-25VideoCommon: return 0 if bbox is disableddegasus
Through just returning the last written value sounds better, this crashes Paper Mario. In my opinion, gfx issues are fine on older GPUs, but crashes should not happen.
2015-05-25VideoCommon: Make BBox emulation optionaldegasus
2015-04-06Fifo: rewrite sync on idle skipping hackdegasus
Now it's done without a busy loop
2015-02-22VideoCommon: perf querys by async eventsdegasus
2015-02-22VideoCommon: bbox by async eventsdegasus
2015-02-22VideoCommon: implement swap requests in the full async waydegasus
2015-02-22VideoCommon: use a new async event system for efb accessdegasus
2015-01-12Made the CPU thread wait for the GPU thread to swap, when XFB is enabled. ↵skidau
May fix some of the "FIFO is overflowed by GatherPipe ! CPU thread is too fast!" errors.
2014-11-17OGL: implement bounding box support with ssbodegasus
This implemention tries to be as accurate as the old SW implemention, but it will remove the dependcy of our vertexloader on videosw.
2014-09-28Add a central variable g_want_determinism which controls whether to try to ↵comex
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-28Add the 'desynced GPU thread' mode.comex
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-20VideoCommon: Fix function casing in FrameBufferManagerBaseLioncash
2014-09-19WIP XFB scaling.magumagu
Still an ugly mess.
2014-08-26Unify three types of non-FIFO requests to the GPU thread around ↵comex
Common::Event and Common::Flag. The only possible functionality change is that s_efbAccessRequested and s_swapRequested are no longer reset at init and shutdown of the OGL backend (only; this is the only interaction any files other than MainBase.cpp have with them). I am fairly certain this was entirely vestigial. Possible performance implications: efbAccessReady now uses an Event rather than spinning, which might be slightly slower, but considering the slow loop the flags are being checked in from the GPU thread, I doubt it's noticeable. Also, this uses sequentially consistent rather than release/acquire memory order, which might be slightly slower, especially on ARM... something to improve in Event/Flag, really.
2014-07-11mark all local variables as staticdegasus
2014-07-11mark all local functions as staticdegasus
2014-06-01Video backends: remove dead code.magumagu
2014-03-29Software backend: Delete forked PixelEngine.magumagu
Mostly just zapping a bunch of duplicated code; the only interesting thing going on here is the changes to the performance counter implementation.
2014-03-14Kill off some usages of c_str.Lioncash
Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
2014-03-11Fixes spacing for "for", "while", "switch" and "if"Matthew Parlane
Also moved && and || to ends of lines instead of start. Fixed misc vertical alignments and some { needed newlining.
2014-02-18Convert all includes to relative paths.Lioncash
2014-02-16Merge pull request #37 from degasus/VideoCommonApiFixesTony Wasserka
VideoCommon API cleanups
2014-02-16Remove the old MMIO access "interface".Pierre Bourdon
2014-02-16MMIO: Port the VideoCommon CP MMIOs to the new interface (and provide ↵Pierre Bourdon
framework for other video related mappings).
2014-02-15merge some common parts of Swap() into VideoCommondegasus
2014-01-09VideoCommon: disable efb access + perf querys on cph threaddegasus
The usual way to handle this kind of request is to rise a flag which the gpu thread polls. The gpu thread itself either generates the result or just write zeros if disabled. After this, it rise another flag which says that this work is done. So if disabled, we still have the cpu-gpu round trip time. This commit just returns 0 on the cpu thread instead of playing ping pong...
2013-12-31Remove unnecessary Src/ foldersJasper St. Pierre