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

[d3d9] FF: Apply transform flags count to generated texture coords #4026

Merged
merged 1 commit into from
May 27, 2024

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented May 25, 2024

Fixes the bug in Phantasy Star Online that was reported after merging #4015.

I've tested this PR with both Phantasy Star Online apitraces, the Cold Fear apitrace and the Snowblind apitrace. Those were the games that I know were broken at some point because of fixed function texture coordinate processing. On top of that, I ran the Wine FF texcoord tests again and those were fine too.


Tests show that the count out of D3DTSS_TEXTURETRANSFORMFLAGS gets applied to generated texcoords like D3DTSS_TCI_CAMERASPACEPOSITION too.

At the same time, projection only gets applied (or renders something sensible) when used with FVF_XYZ and D3DTTFF_COUNT3 or higher. With lower values it either produces garbage like this:

image
(FVF_TEXCOORDSIZE1 + FLAGS_COUNT1)

or this:
image
(FVF_TEXCOORDSIZE2 + FLAGS_COUNT1/2)

https://docs.google.com/spreadsheets/d/1XfSsxl1qMMY0mmpn02l3Wph-6CyXiugcR9wkb0VwJg0/edit?usp=sharing

By writing a test app that uses fixed function vertex processing and a shader that does nothing except output the texcoord, I've now verified that native D3D9 also writes the component that gets used for projection into the w component just like we're doing here.

... and fix cases where projection doesn't get applied.
@K0bin K0bin added the d3d9 label May 25, 2024
@K0bin K0bin requested review from misyltoad and doitsujin May 25, 2024 12:54
@K0bin
Copy link
Collaborator Author

K0bin commented May 25, 2024

@nolrinale This PR fixes the ripples.

@nolrinale
Copy link

@nolrinale This PR fixes the ripples.

I just checked it, all working as intended, even the monsters with refraction cloaking too its amazing K0bin thank you so much for your work! now the game is working 100% under Linux/Deck without any graphic bugs left.

Happy 20th Anniversary PSOBB!~

@K0bin
Copy link
Collaborator Author

K0bin commented May 25, 2024

Awesome, thanks for the good bug reports!

@misyltoad
Copy link
Collaborator

Thanks for doing all this :D

@misyltoad misyltoad closed this May 27, 2024
@misyltoad misyltoad reopened this May 27, 2024
@misyltoad misyltoad merged commit 7df8017 into doitsujin:master May 27, 2024
3 checks passed
@K0bin K0bin deleted the texcoord-weird branch May 27, 2024 20:58
@nolrinale nolrinale mentioned this pull request Jun 17, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants