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/HW: Optimize sw/hdr colclip on some blend formulas. #11214

Merged
merged 2 commits into from
May 10, 2024

Conversation

lightningterror
Copy link
Contributor

@lightningterror lightningterror commented May 8, 2024

Description of Changes

GS/HW: Optimize sw/hdr colclip on some blend formulas.
Alpha is either As or Af.
Cd*Alpha, Cd*(1 - Alpha).
When Alpha <= 128 we can let hw blend do it's thing as it won't be able to wrap.

Rationale behind Changes

Brrr, less draw calls, copies, barriers.

Suggested Testing Steps

Helps Sly 2, Big Mutha Truckers, Lord of the rings Third age, so test these games.

Big Mutha Truckers_SLUS-20291_20230214212340 ['Barriers: -2 [39=>37]']
Big.Mutha.Truckers ['Barriers: -2 [134=>132]']
Lord of the Rings, The - The Third Age_SLES-52801_20230919222807 ['Draw Calls: -2 [44=>42]', 'Render Passes: -1 [16=>15]', 'Copies: -1 [8=>7]']
Lord_of_the_Rings_The_-_The_Third_Age_SLES-52801_20230707223226 ['Draw Calls: -2 [189=>187]', 'Copies: -2 [8=>6]']
Lord_of_the_Rings_The_-_The_Third_Age_SLUS-21027_20230404183506 ['Draw Calls: -2 [150=>148]', 'Render Passes: -1 [16=>15]', 'Copies: -2 [9=>7]']
Signore degli Anelli, Il - La Terza Era_SLES-52804_20230331154537 ['Draw Calls: -2 [125=>123]', 'Render Passes: -1 [16=>15]', 'Copies: -2 [9=>7]']

@refractionpcsx2
Copy link
Member

refractionpcsx2 commented May 9, 2024

kind of an aside but would be nice for clarity in this PR, can you update the variable names of alpha_less_one, alpha_c0_less_max_one, alpha_c2_less_one maybe make them less_eq_ or something, because they check <= not just <

Further to that, couldn't Ad of <= 128 also pass if there's no overlap or alpha is masked (or As is <= 128 also, I guess)?

You could also maybe omit the blend_a == 2, since as long as the subtraction is the destination colour, it shouldn't increase the intensity.

@lightningterror
Copy link
Contributor Author

lightningterror commented May 9, 2024

or alpha is masked

That's already handled as CdAs, Cd(1 - As) since the formula is changed it's picked up.
Edit: actually it isn't picked up but it can be.
For RTADescale it can be handled, just wanted to leave it out for another time.

Alpha is either As or Af.
`Cd*Alpha, Cd*(1 - Alpha).`
When Alpha <= 128 we can let hw blend do it's thing as it won't be able to wrap.
@lightningterror
Copy link
Contributor Author

So I checked if it's worth adding Ad conditions but nothing uses them so not going to add them.
Get alpha values have been renamed as suggested.

@lightningterror lightningterror merged commit 58defda into master May 10, 2024
22 checks passed
@lightningterror lightningterror deleted the gs_colclip_opt branch May 10, 2024 19:23
@oltolm
Copy link
Contributor

oltolm commented May 10, 2024

You forgot to rename a variable pxAssert(m_conf.ps.blend_d == 2 || alpha_one);

@lightningterror
Copy link
Contributor Author

Seems so, I'll fix it.

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.

6 participants