Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

GS/HW: Add "Merge Targets" texture-in-RT mode #8271

Merged
merged 4 commits into from Mar 1, 2023

Conversation

stenzek
Copy link
Member

@stenzek stenzek commented Feb 26, 2023

Description of Changes

This mode can construct a source from one or more targets currently on the GPU, taking into consideration differing page pitches.

Fixes shadows in Destroy All Humans. Can also be used for Guitar Hero, although that has a bunch of other clear/invalidation issues in play too.

Before:
Untitled
After:
Untitled

My rambling about DAH:

so they render the shadow map, and to deal with world-space that fall outside the range, since the PS2 has no "clamp to border colour" option, they need a black rectangle around the shadow map
most games will just draw a 1px line in such cases
but no, this bugger offsets the base pointer by -32 (effectively moving the texture towards the right, with the right most page moving down one row), then redraws it with slightly offset texture coordinates
why they couldn't just offset the coordinates instead of shifting the base pointer?
so I've come up with a convoluted "create a source from multiple targets and local memory" method, that also handles differing page pitches (which is needed for guitar hero)
if I'm going to create a whacky solution, I want it to be applicable to more than one game 馃槢

Rationale behind Changes

Closes #55.
Closes #785.

Suggested Testing Steps

Test DAH, I'm not sure if the second game is affected though.
Make sure nothing else is broke.
See if anything else can use this fix? (except Guitar Hero).

@seta-san
Copy link
Contributor

oldest bug issue being fixed :)

@yellows111
Copy link

yellows111 commented Feb 26, 2023

Hey, these shadow errors look like what's happening in Poinie's Poin with it's motion blurs with Render Textures enabled. (Was required for a fix for a regression introduced in v1.7.4111 [#8245])

Would this happen to improve that field?

@stenzek
Copy link
Member Author

stenzek commented Feb 26, 2023

No, unless it was offsetting BPs backwards, or using different pitches (but that part isn't enabled yet).

@yellows111
Copy link

yellows111 commented Feb 26, 2023

No, unless it was offsetting BPs backwards, or using different pitches (but that part isn't enabled yet).

Just tested this, and your assumption was correct. Still looks like it has a strange dark scanline filter with Merge Targets enabled.

Poinie's Poin_SCPS-15013_20230226152528
Poinie's Poin_SCPS-15013_20230226152528.gs.gz (Probably won't show the issue like last time)

Regression? HW Renderer bug? I'm lost on this one: Texture corruption just after entering Nasty Sewerage
Poinie's Poin_SCPS-15013_20230226152142
Poinie's Poin_SCPS-15013_20230226152142.gs.gz

@stenzek stenzek marked this pull request as draft February 26, 2023 16:39
@Dreadmoth
Copy link
Contributor

Test DAH, I'm not sure if the second game is affected though.

Destroy All Humans! 2 is affected. 馃憤

A small issue remains - shadows in the right-most 64 pixels (native) get stretched (clamped?) to the right edge.

Before:
DAH2before
After:
DAH2after
Software:
DAH2SW

GS dump: Destroy All Humans 2 - Make War not Love_SLES-54384_Shadows.gs.gz

@stenzek
Copy link
Member Author

stenzek commented Feb 27, 2023

Yeah, I'm aware of the right-side-stretching thing, it affects DAH1 too.

... instead of just the first page it falls within.
Can take several targets from the cache, and create a combined/merged
source from them.

Fixes shadow maps in Destroy All Humans.
@stenzek stenzek marked this pull request as ready for review February 28, 2023 15:21
@stenzek
Copy link
Member Author

stenzek commented Feb 28, 2023

Right side issues should be fixed now. Also auto enabled the fix for DAH2 in the gamedb.

@refractionpcsx2 refractionpcsx2 merged commit 64b38e5 into PCSX2:master Mar 1, 2023
@stenzek stenzek deleted the destroy-all-texture-caches branch March 21, 2023 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd shadows in Hardware mode for Aqua team, Ninja golf Destroy all Humans
6 participants