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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GS: Drop to SW for CLUT draws #7267

Merged
merged 2 commits into from
Oct 30, 2022
Merged

GS: Drop to SW for CLUT draws #7267

merged 2 commits into from
Oct 30, 2022

Conversation

refractionpcsx2
Copy link
Member

@refractionpcsx2 refractionpcsx2 commented Oct 22, 2022

Description of Changes

Tidy up some of the code.
Split out CLUT checks for drawing overwrite of the CBP (CLUT source address).
When drawing to the CLUT, use the sw renderer to do the heavy lifting

Rationale behind Changes

Tidy code is happy code.
Old check for CLUT invalidation on draw wasn't really sufficient, now it checks more thoroughly.
Drawing the CLUT in hardware on the GPU, then invalidating the CLUT in GS memory and downloading it, thousands of times a frame in some cases, is slow and the HW renderer purposefully has a guard against this happening, but it breaks CLUT related stuff in the process, this forces those draws to be done in software so there's no issues arising from upscaling and there's no download required, so there's no huge performance loss.

Suggested Testing Steps

Test stuff with lights showing through objects, bad colours, completely missing stuff. You will possibly need to change the new "CPU Clut Render" option in the HW fixes screen, but the below games have been added to the DB.

⚠️ NOTE: If you still experience light bleed, first check game fixes are enabled and hw manual fixes are disabled. If it's still broken, try lowering the upscale (though I think I've resolved this)⚠️

Stuff this PR fixes

120-en no Haru: 120 Yen Stories - Broken sprite colours (actually had an alternative gamefix, but has been replaced)
Ace Combat 05 - Sun occlusion
Alias - Light occlusion (See-through lights)
Burnout 3/Dominator/Revenge - Sun occlusion
Cyber Troopers Virtual-On - Missing colours
Dog's Life - Jake going black when in smell-o-vision (maybe misdetection, but I'll take it)
Driver Parallel Lines - Car/People colours
Godfather, The - Light occlusion through walls. still need skipdraw 1 to remove post effect fail.
Guitar Hero Metallica - Bad colours during gameplay
Klonoa 2 - Pipe monster shadow, green platform transition effect, miscoloured enemies/objects
Minority Report - Light occlusion
PDC World Championship Darts 2008 - Light occlusion and overbright issues when Autoflush was enabled
Need For Speed Most Wanted - Sun occlusion
Fighting Vipers - Missing colours
Last Bronx - Missing colours
Sega Rally 95 - Missing colours (menu background requires disable depth)
Sonic Fighters - Missing colours
True Crime New York City - Light occlusion
Virtual Fighter 2 - Missing colours

Fixes #1860 (Ace Combat 05)
Fixes #5409 (Alias)
Fixes #883 (Burnout 3/Revenge/Dominator)
Fixes #451 (Driver - Parallel Lines)
Fixes #6105 (Fighting Vipers and other mentioned Sega Model 2 games)
Fixes #6723 (Klonoa 2 Platform transition)
Fixes #5200 (Klonoa 2 Shadow)
Fixes #6720 (Klonoa 2 Miscoloured enemies/objects)
Didn't solve #2942 (Hot Pursuit)
Fixes #3993 (NFS Most Wanted)

Compairson shots

120-en no Haru: 120 Yen Stories:

Master (without CRC hack)
image

PR (without CRC hack)
image

Ace Combat 05:

Master:
image

PR:
image

Alias:

Master:
image

PR:
image

Burnout 3:

Master:
image
image

PR (Requires Autoflush + Preload frame, possibly)
image
image

Cyber Troopers Virtual-On:

Master:
image

PR:
image

Driver - Parallel Lines:

Master:
image

PR:
image

Godfather, The:

Master:
image

PR:
image

Klonoa 2:

Master:
image
image
image

PR:
image
image
image

Minority Report:

Master:
image

PR:
image

Need for Speed Most Wanted:

Master:
image

PR:
image

PDC World Championship Darts 2008:

Master:
image

PR:
image

Sega Rally 95:

Master:
image

PR:
image

Sonic Fighters:

Master:
image

PR:
image

True Crime New York City:

Master:
image

PR:
image

Virtual Fighter 2:

Master:
image

PR:
image

@github-actions github-actions bot added the GS label Oct 22, 2022
@refractionpcsx2 refractionpcsx2 changed the title GS: Clean up some state/clut things, more in depth clut overwrite check. GS: Drop to SW for CLUT draws Oct 22, 2022
@refractionpcsx2
Copy link
Member Author

Okay uhh, I kinda blew the scope of this PR out of the water a little, but at least now it's actually a huge improvement and not just some boring tidy up work.

@refractionpcsx2
Copy link
Member Author

Okay the new stuff is actually a hw fix option now (temporarily added to the global settings but will be moving to per-game for release builds)

So if you have a game you wanna see if it helps, you can find it there for now.

Bonus:

Added 3ish new game to the list of fixes.

@waspennator
Copy link

Speaking of the Sega Ages games, shouldn't this be enabled for Last Bronx too, since it runs on the sega model 2 engine and also seems to have similar color issues according to others?

@refractionpcsx2
Copy link
Member Author

Speaking of the Sega Ages games, shouldn't this be enabled for Last Bronx too, since it runs on the sega model 2 engine and also seems to have similar color issues according to others?

Thanks! I didn't know about that one, so I've added it :)

@AhayriSG
Copy link

@refractionpcsx2
Copy link
Member Author

3490 True Crime - New York City_SLES-53616_20221027102030 GS Dump True Crime - New York City_SLES-53616_20221027102030.gs.gz

Thanks! I've added it to the GameDB :)

image

@refractionpcsx2 refractionpcsx2 force-pushed the gs_stateclutclean branch 2 times, most recently from d1424d1 to 359df9e Compare October 27, 2022 11:30
@refractionpcsx2
Copy link
Member Author

Added Klonoa 2 to the list, fixes all the colours of objects, shadows, enemies, platform transitions.

@refractionpcsx2 refractionpcsx2 force-pushed the gs_stateclutclean branch 2 times, most recently from a0ad057 to 0464c86 Compare October 27, 2022 14:51
@refractionpcsx2
Copy link
Member Author

Added The Godfather - The Game (fixes the lights through objects but not the post filter, needs skipdraw 1 for that)

@refractionpcsx2 refractionpcsx2 force-pushed the gs_stateclutclean branch 2 times, most recently from 51a652d to 6fc8b84 Compare October 27, 2022 18:08
@refractionpcsx2
Copy link
Member Author

refractionpcsx2 commented Oct 27, 2022

Had to remove NFS Hot Pursuit 2's Busted screen, it was a misdetection as I suspected and having that working as it did (not greatly) was breaking Klonoa which was also misdetecting and breaking the picture, the behaviour which NFS relied on. As this PR was for fixing the CLUT issues, avoiding misdetection was champion, so I decided to remove it.

I have attached the draws for NFS to the relevant issue for further investigation in to a proper solution.

@DonelBueno
Copy link

DonelBueno commented Oct 27, 2022

Great work, refraction!

I saw a mention of GT4 in this PR another day, but it didn't fix the sun through objetcs from my testing. Do you know what is the problem there?

@refractionpcsx2
Copy link
Member Author

refractionpcsx2 commented Oct 27, 2022

Uhh I removed mention of that because it seems to be a different issue. One tester said preload frame fixed it, but also lowering the resolution fixes it, it could be an issue with upscaling there.

But thanks :)

@DonelBueno
Copy link

DonelBueno commented Oct 28, 2022

Hmm, that's true, it works fine at native resolution, even on the master build. Preload frame data didn't make a difference here, no luck at 2x resolution or above.

@refractionpcsx2
Copy link
Member Author

In a weird coincidence with a support issue. Turns out this fixes the weird colours in Guitar Hero - Metallica, so I've added it to the gamedb

@refractionpcsx2 refractionpcsx2 force-pushed the gs_stateclutclean branch 2 times, most recently from 57fcdd5 to db420df Compare October 29, 2022 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment