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

[WIP] Fix vertical lines #897

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kernle32dll
Copy link
Contributor

Didn't know what to call this PR - it fixes quite a bit more then than the title suggests.

The PS2 assumes the 0,0 pixel at the center of the screen. OpenGL (at least) assumes the 0,0 pixel at the top left. When the screen width/height is even, this causes a slight discrepancy of half a pixel.

In all games I tested this yields very neat results, and fixes all kinds of slight visual artifacts. For me, notable text rendering and text boxes in Suikoden 5, as well as briefings in Ring of Red.

This needs more testing with different games. Together with #895, this fixes most visual problems of the games that start for me. But for cleanness purposes, the following screenshots are without the fixes in #895.

Lego Star Wars II

Click to expand!

This issue is only visible in tandem with #895, so differences are show to this PR here!

Screenshot from 2020-05-03 01-35-49
Screenshot from 2020-05-03 01-34-43

Ring of Red

Click to expand!

Screenshot from 2020-05-03 01-31-17

Screenshot from 2020-05-03 01-21-30

Suikoden 5

Click to expand!

Look especially at the question mark at the bottom!

Screenshot from 2020-05-03 01-39-19
Screenshot from 2020-05-03 01-38-10

Screenshot from 2020-05-03 01-20-01
Screenshot from 2020-05-03 01-20-28

@Zer0xFF
Copy link
Contributor

Zer0xFF commented May 3, 2020

quickly tested this on few games.
this fixes black vertical lines in Ace Combat 5, however only at x1 resolution, not at higher ones
FFXII/AceC 5 you get "extra" pixels on the left side on higher resolutions.
no such artificates effect in KH even on higher resolutions

ACE: Click to expand ![Screenshot 2020-05-03 at 02 53 49](https://user-images.githubusercontent.com/5013823/80896786-0c034c00-8cea-11ea-9958-c6edc1d6fb16.png)

Screenshot 2020-05-03 at 02 59 46

FFXII

Screenshot 2020-05-03 at 02 23 35

@kernle32dll
Copy link
Contributor Author

So far, Lego Star Wars was the toughest case for me. We did talk briefly about rounding - maybe the final fix is two-fold? Offsetting the center, and then some rounding magic?

@@ -611,6 +611,9 @@ void CGSHandler::WriteRegisterImpl(uint8 nRegister, uint64 nData)

switch(nRegister)
{
case GS_REG_ST:
m_nReg[nRegister] &= 0xFFFFFF00FFFFFF00;
Copy link
Owner

Choose a reason for hiding this comment

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

These (ST) are floating point values. Does it makes sense to mask out the last 8 bits of these values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, thats what the GS manual explicitly states.

According to the GS manual, the 8 lower bits of S and T of GS_REG_ST must be rounded down. This commit just masks them away, which just serves that purpose.
The PS2 assumes the 0,0 pixel at the center of the screen. OpenGL (at least) assumes the 0,0 pixel at the top left. When the screen width/height is even, this causes a slight discrepancy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants