[d3d9] FF: Apply transform flags count to generated texture coords #4026
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeD3DTSS_TCI_CAMERASPACEPOSITION
too.At the same time, projection only gets applied (or renders something sensible) when used with
FVF_XYZ
andD3DTTFF_COUNT3
or higher. With lower values it either produces garbage like this:(FVF_TEXCOORDSIZE1 + FLAGS_COUNT1)
or this:
(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.