Skip to content

GS-HW: Improvements to tex in rt + invalidation#8289

Merged
refractionpcsx2 merged 15 commits intomasterfrom
gs_alignedrect
Mar 18, 2023
Merged

GS-HW: Improvements to tex in rt + invalidation#8289
refractionpcsx2 merged 15 commits intomasterfrom
gs_alignedrect

Conversation

@refractionpcsx2
Copy link
Copy Markdown
Member

@refractionpcsx2 refractionpcsx2 commented Feb 27, 2023

Description of Changes

Tries to use page aligned rect calculations when possible for Invalidation, which is a lot more frequent than I hoped, so that's good. Also extended it to TextureInRT since surface offsets seems to give garbage results in some cases and this works much better.

Also clear semi-dirty render targets when used for sources.

Rationale behind Changes

Surface offsets isn't really designed to translate an incoming rectangle to physical blocks, which are not in a linear order, so the positions it gives can be incorrect for the hardware renderer and our very linear rectangles.

Suggested Testing Steps

Test games, plus those listed below.

Fixes Ape Escape 3 pause screen regression (Invalidation misdetection)
Fixes Final Fantasy X transitions if you pause during them (invalidation misdetection)
Fixes Dog's Life Smell-o-vision causing corruption when leaving that mode (hopefully, I hate this game)
Fixes #8067 garbage in Urban Reign during fight scenes. (texture in rt dirty rects)
Fixes #7468 Monopoly corrupt/segmented screen (texture in dirty target)
Fixes Driving Emotion Type-S underlying issue with bad dirty rect
Fixes #2296 Trivial Pursuit (Texture in dirty target)
Fixes #2289 Hasbro Family Game night (Texture in dirty target, probably)
Fixes Primal glitchy textures (Texture in RT stuff, most likely)
Mostly fixes the LEGO Racers 2 sun bleed, not sure if it's just the game now or still a bug. (position in Z target on readback)
Fixes the Gundam Battle Assault 3 - Ft Gundam Seed lights in the background. (missing Z target on readback)
Fix regression on Takahashi Naoko no Marathon Shiyou yo! Setting width of 0, which later gets replaced, but it was being avoided (width 0 should always be replaced) Handled in another PR already merged
Fixes Indiana Jones and the Emperors Tomb map (invalidation issues)
Fixes #3285 Metal Gear Solid 2's cutscene overlays (partial invalidation of different widths)
Fixes Zone of Enders 2nd Runner cutscene blur/post (partial invalidation of different widths)
Fixes #3668 Black screen on K-1 Grand Prix games (PCRTC output frame dirty) - Would recommend continuing to use the patch if you want upscaling.
Fixes #3155 Xenosaga Episode III crystaline surfaces and tex in rt compatibility.

Monopoly:
Master:
image

PR:
image

Trivial Pursuit:
Master:
image

PR:
image

Urban Reign:
Master:
image

PR:
image

Hasbro Family Game Night:

Master:
image

PR:
image

Indiana Jones and the Emperors Tomb:

Master:
image

PR:
image

Gundan Battle Assault 3:

Master:
image

PR:
image

@refractionpcsx2 refractionpcsx2 changed the title GS-HW: use page aligned rects for inexact matches when possible GS-HW: Improvements to tex in rt + invalidation Feb 27, 2023
@Shoegzer
Copy link
Copy Markdown

Good stuff @refractionpcsx2. This PR does clean up some of the texture garbage with Vulkan in TC:NYC as I mentioned here, however there is still some remaining. For example, when transitioning from indoors > outdoors, there is a rectangle of garbage visible in the lower-right corner of the load screen (prior to this PR it filled the entire screen). I was finally able to capture this using a multi-frame GS dump, here.

There is also a small rectangle of garbage in the lower-right that still frequently displays while driving, but I'm yet unable to capture that one without generating a massive GS dump. Hopefully these two are linked and that won't be necessary.

@refractionpcsx2
Copy link
Copy Markdown
Member Author

Cool, True Crime wasn't really my focus, but it's nice that it helps :) I'm still kinda working on this, ironing out some bugs when using texture in rt with the page align stuff. should be done with it soon, hopefully.

@refractionpcsx2
Copy link
Copy Markdown
Member Author

Okay I think this PR is ready for review/testing :)

@refractionpcsx2 refractionpcsx2 force-pushed the gs_alignedrect branch 2 times, most recently from 20074b5 to a9f9464 Compare March 1, 2023 16:27
@refractionpcsx2 refractionpcsx2 force-pushed the gs_alignedrect branch 3 times, most recently from 1abc62b to e38824f Compare March 1, 2023 23:20
@bigol83
Copy link
Copy Markdown

bigol83 commented Mar 2, 2023

I tried this PR on Dragon Quest VIII and it fixes the black border lines but there is now this graphic glitch on torches

Dragon Quest VIII - Journey of the Cursed King_SLES-53974_20230302195953

@RedDevilus
Copy link
Copy Markdown
Contributor

Can you post a gs dump? Tools > Single Frame GS Dump, which will be posted in PCSX2/snaps alongside screenshot. Then just double zip it like zst.zip probably works.

@bigol83
Copy link
Copy Markdown

bigol83 commented Mar 2, 2023

Dragon Quest VIII - Journey of the Cursed King_SLES-53974_20230302201912.gs.zip

Here it is

EDIT: I just checked. It doesn't show the glitch in gsdump, weird.

@yellows111
Copy link
Copy Markdown

yellows111 commented Mar 3, 2023

Testing this: Poinie's Poin's motion blur works [one of the issues you couldn't capture with a GSDump] with RT!
Before:
Poinie's Poin_SCPS-15013_20230225093303

After, Inside Target:
Poinie's Poin_SCPS-15013_20230303081229

After, Merge Targets:
Poinie's Poin_SCPS-15013_20230303080610

@refractionpcsx2
Copy link
Copy Markdown
Member Author

Does that work on master as well using the same setting?

@yellows111
Copy link
Copy Markdown

Does that work on master as well using the same setting?

v1.7.4179
Poinie's Poin_SCPS-15013_20230303081742

Doesn't seem like it.

@refractionpcsx2
Copy link
Copy Markdown
Member Author

refractionpcsx2 commented Mar 3, 2023

cool! :) Is there any way you could do a multi frame GS Dump of that so I can do some testing? as I'm currently rewriting some of the functions on this PR to suck less, and it's good to have some test cases :) It should be holding down Ctrl+Shift+F8 by default, but you can change it in the hotkeys

Thanks!

@yellows111
Copy link
Copy Markdown

yellows111 commented Mar 3, 2023

cool! :) Is there any way you could do a multi frame GS Dump of that

I mean, yeah, i've got GSDumps of this happening, but the GSDump viewer appears to be based on GS/SWRenderer rather than GS/HWRenderer, which I guess makes sense for general graphical issues that would show up in SW (and thus, effect all renderers in theory), which makes it not show HW-only issues such as this.

Poinie's Poin_SCPS-15013_20230225094038.gs.xz.gz (sorry for the file extension, it's just most Multi-frame GSDumps' of these are over 25mb compressed (even in Zstandard), which means no inline uploads)

If I wanted to try and complain about the GSDump viewer, then maybe a new issue would be better for that (example: The "Confirm Disc Change" dialog does not make sense when viewing a GSDump)

@refractionpcsx2
Copy link
Copy Markdown
Member Author

refractionpcsx2 commented Mar 3, 2023

Oh that's annoying, the dump doesn't show it (working fine on master without any additional settings over what's already in the GameDB) :(

@bigol83
Copy link
Copy Markdown

bigol83 commented Mar 3, 2023

This is a better gsdump because it clearly shows DQ8 torch glitch.

Dragon Quest VIII - Journey of the Cursed King_SLES-53974_20230303225648.gs.zip

@refractionpcsx2
Copy link
Copy Markdown
Member Author

refractionpcsx2 commented Mar 4, 2023

hmm the torch looks the same in hardware and software here :/

Can you run the GS dump yourself and check?

@MetrosexualGarbodor
Copy link
Copy Markdown
Contributor

"Inside Target" does indeed fix the crystals in Xenosaga III, but it still breaks the intro.

image

@refractionpcsx2
Copy link
Copy Markdown
Member Author

alright, that's a shame, but I'll check the intro out. thanks for checking!

@refractionpcsx2
Copy link
Copy Markdown
Member Author

Kind of a late improvement, not perfect still but it's certainly better.

WRC 4:

Master:
image

PR:
image

@refractionpcsx2
Copy link
Copy Markdown
Member Author

refractionpcsx2 commented Mar 18, 2023

@MetrosexualGarbodor sorry can you test a new build of this PR again on Xenosaga Ep3, I think I caught the problem you were having. If you turn all manual fixes off and let the auto fixes happen (I've put the tex in rt stuff on in the DB) and let me know if everything is good? Thanks :)

Copy link
Copy Markdown
Contributor

@Toastarrr Toastarrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MGS2 "box" artifact seems to be gone, the slow motion effect works, and the blur doesn't create the junk frame. Excellent PR as far as MGS2 is concerned.

@refractionpcsx2
Copy link
Copy Markdown
Member Author

Thanks @Toastarrr !

@MetrosexualGarbodor
Copy link
Copy Markdown
Contributor

With the latest changes, the intro no longer breaks and the crystals are still fixed.
image
image

I also checked several other parts of the game that usually have trouble and couldn't find anything else broken. All of this on Vulkan.

After this, the only remaining issues with Xenosaga III will be that weird ceiling shadow and the upscaling problems. Nicely done. 👍

@refractionpcsx2
Copy link
Copy Markdown
Member Author

nice! Thanks for testing! :)

@CookiePLMonster
Copy link
Copy Markdown
Contributor

Regresses reflections in The Getaway.

v1.7.4244:
image

v1.7.4245:
image

@stenzek
Copy link
Copy Markdown
Contributor

stenzek commented Jul 18, 2023

For documentation's sake, I'll copy/paste what I said here:

start of frame, then it draws the reflection map (128x128) to 2800(RT)+2C00(Z)
then it downloads 2800
then it swaps to 640x448 1180(RT)+2300(Z)
so it's putting the reflection RT in the middle of the depth for the last frame
surely it clears for the reflection RT.. yep, it does
so we'd need to kill any overlapping targets on clear, not targets which are fully contained by the clear
and that seems like a big risk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment