Skip to content

[d3d8/9] Proper (and age accurate) handling of d3d9.shaderModel = 0 - #4629

Merged
K0bin merged 1 commit into
doitsujin:masterfrom
WinterSnowfall:shadermodel0
Jan 26, 2025
Merged

K0bin merged 1 commit into
doitsujin:masterfrom
WinterSnowfall:shadermodel0

Conversation

@WinterSnowfall

@WinterSnowfall WinterSnowfall commented Jan 20, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #4625 and follows up on an idea I've had in the d8vk days, see AlpyneDreams#208.

Extends D3D7-compatible FF only caps (aka disabling programmable shader support) to D3D8 when using d3d9.shaderModel = 0, and also validates shader versions on creation in D3D9.

Useful for debugging and for nostalgia reasons (with games that do handle such situations properly).

@WinterSnowfall
WinterSnowfall force-pushed the shadermodel0 branch 4 times, most recently from e300bfb to db884c1 Compare January 21, 2025 15:00
@WinterSnowfall

Copy link
Copy Markdown
Contributor Author

I wasn't expecting any revelations from testing the caps on my GeForce 4 MX 440 card, but apparently I was wrong.

Late generations of fixed-function only hardware actually advertised support for VS 1.1 (with no PS support), which makes a lot of sense actually, since games would try to use VS 1.1 anyway, even if we tried to force them to not create programmable shaders of any kind.

This PR replicates the above behavior when d3d9.shaderModel = 0 is used and also fixes some other minor SM1 derps.

@WinterSnowfall
WinterSnowfall marked this pull request as ready for review January 21, 2025 15:04
@WinterSnowfall WinterSnowfall changed the title [d3d8/9] Properly disable programmable shaders with d3d9.shaderModel [d3d8/9] Proper (and age accurate) handling of d3d9.shaderModel = 0 Jan 21, 2025
Comment thread src/d3d9/d3d9_device.cpp Outdated
@WinterSnowfall
WinterSnowfall force-pushed the shadermodel0 branch 2 times, most recently from 065c35e to 5113fd8 Compare January 22, 2025 16:38
@WinterSnowfall

WinterSnowfall commented Jan 22, 2025 •

Copy link
Copy Markdown
Contributor Author

One more nit: turns out the MaxVS/PShaderInstructionsExecuted caps are SM2 (and above) specific and will be zero otherwise.

@K0bin K0bin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good job.

@K0bin
K0bin merged commit c6dc7e0 into doitsujin:master Jan 26, 2025
@WinterSnowfall
WinterSnowfall deleted the shadermodel0 branch January 26, 2025 12:57
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.

Skybox position, scale, and orientation incorrect and variable when using d3d9.shaderModel = 0

2 participants