Commit graph

334 commits

Author SHA1 Message Date
Henrik Rydgård
7a7117f2f7 Cache framebuffer copies (for self-texturing) until the next TexFlush instruction.
Fixes #17030 , or at least improves on it - for optimal performance that
big framebuffer used for bloom should be split like in Killzone, but it's not trivial.

The regression in 1.14 is fixed with this, at least.

I tried it with a few other games with no issues - it seems games are
using TexFlush when needed. But let's see if it really is safe to rely
on that...

There might also be other places we should call DiscardFramebufferCopy
in.
2023-03-01 22:42:22 +01:00
Henrik Rydgård
970f7993df Android: Make font rendering work even absent support for R4G4B4A4 textures.
This shouldn't normally happen as conforming drivers are required to
support that texture format, but the software driver that we
accidentally choose on Poco C40 (see issue #16391) doesn't.

That we choose that driver will be fixed separately. This fix on its own
at least lets the user comfortably navigate to settings and switch to
OpenGL.
2023-02-28 00:01:29 +01:00
Henrik Rydgård
8b431b39ba
Wrap the display globals in a struct (#16998)
* Wrap the display globals in a struct

Makes it easier to search/replace these, for future refactorings.

* Some renaming

* Qt buildfix, also fix the Qt build on Mac (got broken with battery changes)

* Attempt at buildfixing ios

* UWP buildfix
2023-02-25 13:09:44 +01:00
Henrik Rydgård
49e5460c9c Remove count parameter from SetViewports. No use foreseen. 2023-02-25 07:12:53 +01:00
Henrik Rydgård
adda49d05d Add a heuristic avoiding joining framebuffers horizontally
...when texturing from the other one.

Greatly improves GPU performance in Rainbow Six: Vegas.

Fixes #9324.
2023-02-15 15:35:28 +01:00
Henrik Rydgård
ae9291f3b5 More work on depth copies. Seems to be enough for Iron Man. 2023-02-15 07:35:07 +01:00
Henrik Rydgård
62a6f351d5 Initial work on depth copies 2023-02-15 07:35:07 +01:00
Henrik Rydgård
27a03de826 CreateRAMFramebuffer: Don't create a depth buffer by default 2023-02-15 07:35:07 +01:00
Henrik Rydgård
6b902a7d6b Minor code cleanup, one very minor stride bugfix 2023-02-15 07:35:07 +01:00
Henrik Rydgård
1938fa44d4 Split the depth copy shader into depth copy and depth encode, dynamic depth scale in Draw2D 2023-02-11 18:24:07 +01:00
Henrik Rydgård
a083a65f77 Depal: Get depth scale factors dynamically 2023-02-11 16:12:58 +01:00
Henrik Rydgård
d65dae7185 Depth scale functions: Clean up the naming, add a failing test 2023-02-10 14:57:45 +01:00
Henrik Rydgård
d426ce5118 Clear depth buffers after changing depth rounding mode.
And thus change of depth buffer scale/offset.

Previously, old depth buffers with values that now are out of range
could stick around, causing #16941. This clears them to the expected 0
value, which helps Outrun. Ideally we should convert depth buffers to
the new format, but if we can get away without that, that's also nice.

This is enough for #16941.
2023-02-10 10:03:14 +01:00
Unknown W. Brackets
aff0b46523 GPU: Skip depth resize when forcing 1x. 2023-02-08 18:45:01 -08:00
Henrik Rydgård
ab63689cca Remove bad comment 2023-02-08 15:37:06 +01:00
Henrik Rydgård
94f51d5d26 Make the Dangan Ronpa readback async 2023-02-07 23:13:36 +01:00
Henrik Rydgård
5f13bc061a Color readback: Read the previous framebuffer instead of the one being switched to 2023-02-07 23:13:36 +01:00
Henrik Rydgård
b3e6b81e43 Implement delayed depth readbacks for Vulkan only 2023-02-07 23:13:36 +01:00
Henrik Rydgård
23049533b9 Restore GetDepthBuffer precision - the stretchy-color-readback path is not suitable for this. 2023-02-05 22:58:26 +01:00
Henrik Rydgård
937975000b Add a ReadbackMode parameter to more functions in the FramebufferManager 2023-02-05 13:57:45 +01:00
Henrik Rydgård
92f4de7b74 Small cleanup. Let's reduce the number of readback paths. 2023-02-05 13:57:45 +01:00
Henrik Rydgård
4427cb4fc3 Add parameter to thin3d::CopyFramebufferToMemory to specify blocking mode. Not yet implemented. 2023-02-04 23:40:36 +01:00
Henrik Rydgård
281b0d6aab Quick fix for the lens flare in Burnout
We have to assume that ForceLowerResolutionForEffects has been set for
good reason - in this case, the effect probably can't safely function
without it.

Fixes #11100 once again.
2023-02-04 18:01:53 +01:00
Henrik Rydgård
236611ac16 Initial implementation of depth readback for Syphon Filter. Fixes the lens flares. 2023-02-04 13:54:57 +01:00
Henrik Rydgård
62484f01ed Make ReadbackFramebufferSync able to use the stretch ability of ReadbackDepthbufferSync 2023-02-04 12:05:50 +01:00
Henrik Rydgård
c7234aa3b5 Handle scaling internally in ReadFramebufferSync 2023-02-04 11:36:48 +01:00
Henrik Rydgård
23c8a79473 Make depth readback through the "color path" work on all backends except D3D9 2023-02-03 20:59:58 +01:00
Henrik Rydgård
f2a6c744bc Add built-in stretch functionality to depth readback shader path 2023-02-03 19:06:40 +01:00
Serena
30f6296767 Remove some Windows + Qt stuff + meow 2023-01-27 19:12:41 +03:00
Henrik Rydgård
e1a48d74c4 A bit more GetPointer cleanup.
Probably not worth it for performance reasons, but some semantic cleanup
is good, especially the accidental GetPointer -> writable casts without
using GetPointerWrite.

Using Unchecked on already checked pointers, or when we'd crash anyway
if it returned nullptr, is good for clarity.
2023-01-10 12:13:47 +01:00
Unknown W. Brackets
e5d67119a8 GPU: Avoid bloom hack on buffers used for depth.
If a buffer even has depth transferred to it, let's avoid lowering its
resolution.
2023-01-05 18:00:43 -08:00
Henrik Rydgård
a5747d53b3 Fix some report spam 2023-01-02 22:23:50 +01:00
Unknown W. Brackets
49f6c461ad Reporting: Fix some header includes.
Particularly in Common, avoid including Core/Reporting.h.
2022-12-27 14:58:20 -08:00
Henrik Rydgård
11366a2ded Don't refer directly to g_Config.iMultiSampleLevel, it can contain unsupported modes. 2022-12-14 16:43:37 +01:00
Unknown W. Brackets
1810692236 Global: Cleanup some type/range checks. 2022-12-10 21:13:37 -08:00
Unknown W. Brackets
a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Henrik Rydgård
3e9f62a3a4 Minor fixes 2022-12-10 12:28:56 +01:00
Henrik Rydgård
4ec1e2a175 Some minor initialization fixes, and one potential crash found by static analysis 2022-12-10 11:28:19 +01:00
Henrik Rydgård
7aab096791 LittleBigPlanet: Compat flag to work around smoke rendering problem
See #16030

Hopefully just for the release. There might be a tweak of our heuristics
that can fix it too, but much riskier at this point.
2022-12-07 13:29:47 +01:00
Henrik Rydgård
8567416be6 Force "Lower resolution for effects" off in Ratchet & Clank and a few other games
It breaks or just makes things look terrible in these games, so no
reason to allow it.

An alternative for this would be to remove the option entirely, and only
use it though the ForceLowerResolutionForEffectsOn flag instead.
2022-12-03 23:35:54 +01:00
Henrik Rydgård
35777d5eef Use proper copies for depth blits between multisampled framebuffers. Needed to keep all the information. 2022-12-02 15:26:29 +01:00
Henrik Rydgård
8a3e92aa38 Not pretty, but with this, you can switch MSAA level at runtime. 2022-12-01 23:41:31 +01:00
Henrik Rydgård
b9ea8de135 Use raster copies to work around lack of working copy support in MSAA mode. 2022-12-01 22:49:00 +01:00
Henrik Rydgård
e3679df6cf Fix switching between MSAA levels 2022-12-01 22:49:00 +01:00
Henrik Rydgård
4dfce4f6bc Basically working MSAA on desktop GPUs! Some glitches remain. 2022-12-01 22:49:00 +01:00
Henrik Rydgård
06af304c8d Multisampling groundwork 2022-12-01 22:49:00 +01:00
Henrik Rydgård
331d024a8c Add a flags parameter to InvalidateCachedState and rename it Invalidate.
Also rename the old InvalidationFlags enum to InvalidateCallbackFlags.
2022-12-01 19:15:38 +01:00
Henrik Rydgård
390bf3e912 Fix Burnout Dominator lens flare on OpenGL ES
Not the prettiest solution, but works: Use R8_UNORM as a fallback
if R16_UNORM is not available.
2022-11-29 13:05:18 +01:00
Henrik Rydgård
0b375bb357 Colin McRae: Use compat flag to avoid GPU readbacks for VRAM->VRAM copies.
Improves performance when the sun is visible, see #7810
2022-11-26 18:53:13 +01:00
Henrik Rydgård
6d9bb1b29e Move post-processing settings to DisplayLayoutScreen 2022-11-22 23:29:50 +01:00