Commit Graph

82 Commits

Author SHA1 Message Date
Stenzek 852e30bb8c Ubershaders: Fix 6-bit color truncation not being applied 2017-08-01 00:01:09 +10:00
Stenzek 7d78cf0f6f ShaderGen: Implement pixel ubershaders 2017-07-30 17:43:59 +10:00
Scott Mansell 479abde9f4 BPMemory: Convert a number of unions to BitFields 2017-07-30 17:43:59 +10:00
mimimi085181 53663c00b9 Implement minimal emulation of TMEM caching
This is a remake of https://github.com/dolphin-emu/dolphin/pull/3749

Full credit goes to phire.

Old message:
"If none of the texture registers have changed and TMEM hasn't been invalidated or changed in other ways, we can blindly reuse the old texture cache entries without rehashing.

Not only does this fix the bloom effect in Spyro: A Hero's Tail (The game abused texture cache) but it will also provide speedups for other games which use the same texture over multiple draw calls, especially when safe texture cache is in use."

Changed the pr per phire's instructions to only return the current texture(s) if none of the texture registers were changed. If any texture register was changed, fall back to the default hashing and rebuilding textures from memory.
2017-07-10 01:49:27 +02:00
Stenzek ddc5275071 VideoCommon: Drop SetDitherMode()
It was a no-op on all backends apart from GL anyhow.
2017-04-18 21:55:22 +10:00
Markus Wick e99cd57eb3 Merge pull request #4935 from Armada651/depth-range-fix
VideoBackends: Set the maximum range when the depth range is oversized.
2017-03-10 18:05:52 +01:00
Stenzek 277829d842 VideoCommon: Eliminate static state in Renderer 2017-03-04 16:39:50 +10:00
Jules Blok a15555fe03 VideoBackends: Use vertex shader depth range if ztexture is used. 2017-02-26 11:34:48 +01:00
Lioncash 70cf774a5c RenderBase: Forward declare EFBAccessType 2017-01-23 12:41:26 -05:00
degasus 23b0faeba5 OGL: Use VideoCommon blend state for framebuffer configuration. 2017-01-06 14:01:39 +01:00
degasus 04f319066d TextureCache: Extract BP enum check to VideoCommon.
We have TOO many video backends.
2016-12-26 22:10:21 +01:00
Lioncash 58a5395173 TextureCacheBase: Eliminate static state 2016-12-09 16:50:37 -05:00
anthony b427ead0cc Remove Frameskip 2016-10-08 11:49:51 -05:00
Scott Mansell a665743b70 BPStructs: remove case statments which never match.
Visual Studio's code analyzer complains about these.
2016-09-06 00:40:49 +12:00
Pierre Bourdon 3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Lioncash 32ce2be2bf Fifo: Make g_use_deterministic_gpu_thread a TU-local variable 2016-01-25 05:24:03 -05:00
Lioncash 5ebd1e215b Fifo: Make g_bSkipCurrentFrame a TU-local variable
This is only ever queried, making it a global isn't necessary.
2016-01-25 05:23:14 -05:00
Lioncash d9fec92628 VideoCommon: Header cleanup
Also remedies places where the video backends and core rely on things
being indirectly included.
2016-01-17 20:11:45 -05:00
degasus 5f244abf28 Fifo: Create a "Fifo" namespace. 2016-01-12 23:28:26 +01:00
Tillmann Karras 81d9cce70c VideoCommon: rename TextureCache to TextureCacheBase 2015-11-06 15:43:58 +01:00
Scott Mansell 51c984dde3 Remove the "Show EFB Copy Regions" debug option.
It was only implemented in OpenGL, though the option was visible in both
backends, leading to memory leaks if you enabled it in DirectX.

And it wasn't particularly useful as a debug feature as it only showed
where in the EFB the copies were taken from, not what format it was, or
what the copy was used for, or what content was in the EFB at that point
in time.

Also, it stretched the copy regions relative to the window, so the
on-screen regions don't even line up with the window unless the game used
the full EFB (some pal games) and you game image stretched to the full
window.
2015-11-05 18:15:46 +13:00
Scott Mansell ba7b7522be BPStructs: add debug info for texture setup. 2015-11-05 00:13:25 +13:00
Rohit Nirmal a48e425f41 Silence -Wshadow warning. 2015-09-23 11:02:24 -05:00
Scott Mansell a355d9868e FifoRecorder: Use Video Common to record efb2ram correctly.
Texture updates have been moved into TextureCache, while
TMEM updates where moved into bpmem. Code for handling
efb2ram updates was added to TextureCache.

There was a bug for preloaded RGBA8 textures, it only copied
half the texture. The TODO was wrong too.
2015-09-22 23:59:16 +12:00
Scott Mansell 52948bb3ef Cleanup and unify handling of efb copy stride. 2015-09-05 23:37:24 +12:00
JosJuice 0af2bbcea3 Remove extra space from 5a32c3f 2015-09-04 15:32:30 +02:00
booto 5a32c3fba4 VideoCommon: xfb height calculation adjusted
Baten Kaitos allocates its XFBs from a tagged heap
structure. With the old calculation, too many lines
were being written so the tag of the allocation
after the XFB was being corrupted. Fixes crash
mentioned in this comment:
https://code.google.com/p/dolphin-emu/issues/detail?id=7734#c6
2015-09-03 03:57:03 +08:00
booto 86dce8b0f7 VideoCommon: reduce level of debug output 2015-07-27 10:22:40 +08:00
booto efd250494d Video: stride in bytes rather than pixels 2015-07-25 02:48:56 +08:00
booto 2e28ed3291 Video: respect stride of efb copies to xfb 2015-07-25 01:52:12 +08:00
degasus c375111076 Options: merge SCoreStartupParameter into SConfig 2015-06-12 19:07:45 +02:00
Ryan Houdek 69963dc4b0 Merge pull request #2274 from degasus/disable_bbox
Disable bbox
2015-05-25 08:46:12 -04:00
Tillmann Karras 30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
degasus 029912681e VideoCommon: return 0 if bbox is disabled
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-25 09:33:34 +02:00
degasus acd074e291 VideoCommon: Make BBox emulation optional 2015-05-25 09:33:34 +02:00
degasus 809117102e VideoCommon: split VertexLoaderBase from VertexLoader 2014-12-21 14:12:43 +01:00
Jules Blok 55e60a9c22 VideoCommon: Merge LineGeometryShader into GeometryShaderGen.
This adds line-width emulation support to OpenGL.
2014-12-15 22:47:42 +01:00
Jules Blok 382e1c22db GeometryShaderGen: Support multiple primitive types.
And make more stereoscopy code optional.
2014-12-15 22:47:41 +01:00
Jules Blok 332ba4b210 GeometryShaderManager: Upload Line/Point width constants. 2014-12-15 22:47:35 +01:00
Jules Blok b406e4e1f2 VideoCommon: Add a separate constants buffer for the geometry shader. 2014-12-14 21:23:13 +01:00
degasus 6f3e20ac42 OGL: disable bbox writes if not supported 2014-11-22 15:17:57 +01:00
degasus c211450b99 OGL: implement bounding box support with ssbo
This implemention tries to be as accurate as the old SW implemention, but it will remove the dependcy of our vertexloader on videosw.
2014-11-17 21:20:32 +01:00
Scott Mansell ba58cc47a3 Remove old (and now incorrect) error checking code.
We will now rely on Memory::CopyFromEmu to do bounds checking.

Some games actually load palettes from 0x00000000, despite the
fact no valid palette data should ever be there.

Fixes Issue 7792.
2014-10-29 08:53:53 +13:00
Scott Mansell 23832987b5 Revert changes preloading of RGBA8 tiles.
This path should probally be optimised, but it's out of the
scope of this PR.
2014-10-23 18:15:29 +13:00
Scott Mansell 3aa979d7d7 Remove another 3 getPointers.
Thanks neobrain for spotting these.
2014-10-21 12:18:54 +13:00
crudelios 176ea06e82 Get buildbot to compile. 2014-10-10 12:28:15 +01:00
crudelios 2d4b7e3f3f Reimplement Bounding Box calculation using the software renderer. 2014-10-10 12:27:06 +01: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
Tony Wasserka 1d23c2ca8b GPU: Only load the relevant color components upon writes to the tev color registers.
The other two components need not be valid upon write, hence loading them results in glitches.

Fixes issue 6783.
2014-09-21 10:38:22 +02:00