Skip to content

GS:SW: Use doubles for Z#6033

Merged
TellowKrinkle merged 10 commits intoPCSX2:masterfrom
TellowKrinkle:SWDoubleZ
May 26, 2022
Merged

GS:SW: Use doubles for Z#6033
TellowKrinkle merged 10 commits intoPCSX2:masterfrom
TellowKrinkle:SWDoubleZ

Conversation

@TellowKrinkle
Copy link
Copy Markdown
Member

@TellowKrinkle TellowKrinkle commented May 8, 2022

Description of Changes

Makes the SW renderer use doubles for Z

Has a noticeable (~3%) performance hit, so leaving this a draft for now, will only use it for large z values in the future I think we've gotten performance to an acceptable level

Rationale behind Changes

Reduce Z fighting

Suggested Testing Steps

Test KOF, other zequal games / games with z fighting

@TellowKrinkle TellowKrinkle force-pushed the SWDoubleZ branch 5 times, most recently from 6507087 to 5fff6c8 Compare May 8, 2022 05:55
@refractionpcsx2
Copy link
Copy Markdown
Member

Speed losses on games which are fixed by this PR:
Destroy All Humans is fixed, and the perf loss is about 4%, but we're talking at over 210fps in both cases
Tony Hawk is about 6% but again, we're talking about 250fps here
KoF 94 fixed with about a 3.4% perf loss (but again, like 600fps down to 580fps lol)

Random other game speed losses:
GT4 147 -> 135fps (8.2%)
DT Racer 146 -> 135fps (7.6%)
Driv3r 107 -> 101 (5.4%)
CoD 2 107 -> 100 (6.6%)

NFS MW was identical speeds (within margin of error)

Potential issues to make note of or test things from

Meta: #3692

Individual issues:
#5780
#3496
#3609 (but awaiting feedback on some issues)
#5394
#4116

@ghost
Copy link
Copy Markdown

ghost commented May 8, 2022

This Pull Request works just fine with the majority of games I tested on.

However, theoretically, this float->to double approach might not be enough if a game abuse the floating-point arithmetic precision (kind of like what we have on the VUs or the COP1).

I have 2 questions regarding that:

Does the GS have a wider range of floats and/or follow the IEEE 754 standard for this?

And will a soft-float approach, be considered in the future even if, it will likely be very,very slow?

@Lagahan
Copy link
Copy Markdown

Lagahan commented May 8, 2022

Improves Quake 3
Master:

2022-05-08.13-22-17-1.mp4

PR:

2022-05-08.13-26-29-1.mp4

@ghost
Copy link
Copy Markdown

ghost commented May 8, 2022

Hasbro Family Game Night is also fixed, the game table does not exhibit weird artifacts as seen in the issue report (#2289):

From the report:
35777821-cb9ac7fc-09b4-11e8-9980-dbf912d95639

With the PR:

hasbro.mp4

@refractionpcsx2
Copy link
Copy Markdown
Member

refractionpcsx2 commented May 8, 2022

@githubribbon45

However, theoretically, this float->to double approach might not be enough if a game abuse the floating-point arithmetic precision (kind of like what we have on the VUs or the COP1).

Not a scenario that exists (explained below)

I have 2 questions regarding that:

Does the GS have a wider range of floats and/or follow the IEEE 754 standard for this?

The GS doesn't use floats, it's completely integer (using 12.4 FIxed integers at most) (except for Q/ST values), we use floats for speed and convenience of interpolating coordinates. However the Q/ST values are generally within a very small range, unless something has gone very wrong.

And will a soft-float approach, be considered in the future even if, it will likely be very,very slow?

No need here because of above.

@JordanTheToaster
Copy link
Copy Markdown
Member

Sonic Hero's no longer has Z fighting during the opening gameplay.

@ps1freak26
Copy link
Copy Markdown

Ridge Racer 5's shine is back in software mode so #5575 is fixed.

@prafullpcsx2
Copy link
Copy Markdown
Contributor

This pr seems to break game "Trapt". Initial screens are not visible in SW mode. Block dump attached.

Trapt (2022-04-09 01-09-40).zip

@TellowKrinkle
Copy link
Copy Markdown
Member Author

Trapt should be fixed
Was a preexisting bug that was uncovered by me removing zequal

@MarioSonic2987
Copy link
Copy Markdown

Fixes Z-fighting in Worms 4 Mayhem. It's more noticeable in battles.

Before:
image
After:
image

@MrCK1
Copy link
Copy Markdown
Member

MrCK1 commented May 11, 2022

Confirmed that z-fighting in Shox is fixed

PR:
image

Master:
image


@TellowKrinkle TellowKrinkle force-pushed the SWDoubleZ branch 4 times, most recently from 62ab628 to 7bd2314 Compare May 12, 2022 03:21
@TransparentBlue
Copy link
Copy Markdown

Yeah, only SW

@refractionpcsx2
Copy link
Copy Markdown
Member

cool, thanks for the clarification :)

@TellowKrinkle TellowKrinkle force-pushed the SWDoubleZ branch 7 times, most recently from 5e7ed38 to 3ee73df Compare May 17, 2022 00:30
@TellowKrinkle TellowKrinkle marked this pull request as ready for review May 18, 2022 04:18
@TellowKrinkle TellowKrinkle merged commit 9084ef3 into PCSX2:master May 26, 2022
@TellowKrinkle TellowKrinkle deleted the SWDoubleZ branch May 26, 2022 08:51
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.

10 participants