pcsx2
pcsx2 copied to clipboard
GS/HW: Improve detection of clears
Description of Changes
Our clear detection sucks at the moment, in particular for double half/striped-double/FBW clears.
This PR attempts to detect them more accurately, to avoid creating false targets in the TC, and save VRAM bandwidth by using target clears instead of useless draws. At 8x, with 3 draws per frame, that's around 4GB/s of bandwidth saved.
Rationale behind Changes
Correctness Vroom vroom
~~Unfortunately it doesn't seem to directly fix anything that I've seen.~~ But it does make things easier down the line, and the TC less ball-achey.
Fixes #8872. Fixes #9096.
Suggested Testing Steps
Test a range of games, make sure nothing broke. Dump runner has a bunch of diffs, but I've fixed everything I could visibly see issues with.
I tested the game where i had the most framedrops, MGS3 intro, and i see improvements from 1 to 4 fps in heavy scenes, so it's all good there, it's a nice improvement.
I also tested the NFS Underground 2 demo in Burnout 3 because it was quite heavy and it now both in menus and ingame flickers like crazy and it tends to crash the emulator. I managed to take a gsdump, but every time i try to make changes to the game properties the emulator completely crashes. I tested with default settings, native resolution. Hardware renderer all have this flickering issue, software renderer doesn't.
You can easily make the emulator crash by loading the gsdump and then going in Game Properties menu to change settings.
Here is the gsdump Burnout 3 - Takedown_SLES-52585_20230611224107.zip
Here are the crash log and dump
crash-2023-06-11-22-40-23-356.txt crash-2023-06-11-22-40-23-357.zip
I don't know if it's a useless report because technically that demo isn't a game, but in latest nightly this doesn't happen, so maybe it can help you understand what is happening in this case.
I also tested few other games, but there were no issues. Burnout 3 itself runs with no issues whatsoever.
NFS Underground 2 demo in Burnout 3 because it was quite heavy and it now both in menus and ingame flickers like crazy and it tends to crash the emulator
Fixed.
Note for testers: Armored Core and Dog's Life should be checked, since I had to change the draw rect calculation, and according to #8454, they were affected.
Retested with latest updates and now there are some more speed improvements (1-2 fps), NFSU 2 demo in Burnout 3 has no more flickering, doesn't crash the emulator anymore, but there is one little green flashing box in upper left corner, even in native resolution with hardware renderer.
Gsdump
nfsu2 demo.zip
Also, i noticed that at the same exact spot the two exes have quite a big difference in speed. Clang exe in NFS U2 demo has 4-5 fps more than qt64 exe. In Metal Gear Solid 3 intro the difference is less evident, but it's still faster on clang.
Tested this build for Armored Core Nexus, and issue #8450 doesn't occur.
See screenshot (Vulkan with Native resolution)
a4b4907 doesn't cause the issue as well.
Retested with latest updates and now there are some more speed improvements (1-2 fps), NFSU 2 demo in Burnout 3 has no more flickering, doesn't crash the emulator anymore, but there is one little green flashing box in upper left corner, even in native resolution with hardware renderer.
I believe this might be a wont fix for now, as the game is actually drawing this, not sure how it didn't show up before if it didn't, but because we scan out the screen like 1 frame behind it happens before we display the frame, if we swapped it to scan out immediately, you wouldn't see it. However at the moment this causes other problems, so we can't do that :(
but there is one little green flashing box in upper left corner, even in native resolution with hardware renderer.
I already looked into this, it's the PointListPalette hwfix breaking. Sadly it's needed for burnout. So, won't fix unless I feel like working out why burnout needs it.
Clang exe in NFS U2 demo has 4-5 fps more than qt64 exe. In Metal Gear Solid 3 intro the difference is less evident, but it's still faster on clang.
That's normal. Clang produces better vector code, amongst other small differences, over MSVC. That's why we ship it by default for release builds.
Does Siren need to be tested since it does the extra wonky double half clear?
Latest commits fixed the green flashing box in NFSU 2 demo in Burnout 3. Nice.
I've found something interesting that happens on Haunting Ground (yes it's me again), not really a bug per se but a different behavior, when going to the secret room and playing a cutscene from the menu, it's supposed to fade to black until it loads.
In this build, this doesn't happen, it gets dark but doesn't completely fade to black, also if I switch to software renderer and open a cutscene, fades to black properly, skip it so I go back to the cutscene select menu, and switch to HW renderer again, when playing the same cutscene it does fade to black but just that one time, not sure if this helps in any way but wanted to mention in case this can affect some serious stuff down the line.
I uploaded an unlisted video showing this too: https://youtu.be/Ln65Uc5Og-c
Also gsdumps if it helps
When it's supposed to be a black screen but it's not: HGbug1.zip
Software renderer, black screen properly rendered: HGbug2.zip
HW renderer after switching to SW renderer and now shows the black screen properly again: HGbug3.zip
(for some reason, when viewing the 1st gs dump it looks all black like how it's supposed to but when i took it, the screen wasnt showing a black screen, just the dark menu before it completely fades)
*GRAPHICAL ERROR IN GOWII
Updating from 1.7.4671 to 1.7.4672 makes the floor looking like in the picture below. I've tried using different versions and pinpointed this update to be the issue for this problem.
(1.7.4671)
(1.7.4672)
@tuantquy can you provide a GS Dump please?
@refractionpcsx2 Here you go! snapsGOWII.zip This is the .4672 version
Thanks :) We'll get it fixed