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: Handle binding mismatching texture types #4513

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

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented Dec 8, 2024

Fixes #4387

Alpha Protocol binds a cube texture to a slot which is declared as a 2d texture in the shader. Binding a mismatching texture type leads yields (0,0,0,0) (yes, alpha 0, unlike binding NULL) on native D3D9. See the table inside the issue.

I also checked that this is checked at draw time, not at the time of the SetTexture call. So binding a shader with a correct texture type afterwards results in correct rendering and the other way around as well.

Because if there's one thing the D3D9 frontend needed, it is more bit field tracking... :)

@K0bin K0bin added the d3d9 label Dec 8, 2024
@K0bin K0bin changed the title D3d9: Handle binding mismatching textures D3D9: Handle binding mismatching textures Dec 8, 2024
@K0bin K0bin changed the title D3D9: Handle binding mismatching textures D3D9: Handle binding mismatching texture types Dec 8, 2024
@K0bin
Copy link
Collaborator Author

K0bin commented Dec 8, 2024

Fun game bug in Alpha Protocol:

warn: Mismatching view type. Slot: 2. Expected: VK_IMAGE_VIEW_TYPE_2D. Got: VK_IMAGE_VIEW_TYPE_CUBE
warn: Mismatching view type. Slot: 2. Expected: VK_IMAGE_VIEW_TYPE_CUBE. Got: VK_IMAGE_VIEW_TYPE_2D

@K0bin K0bin force-pushed the d3d9-texture-type-mismatch branch 3 times, most recently from 0d8fae0 to e664f96 Compare December 9, 2024 22:41
@K0bin K0bin marked this pull request as ready for review December 10, 2024 10:58
@K0bin
Copy link
Collaborator Author

K0bin commented Dec 10, 2024

I also tried it with Star Wars Force Unleashed 2 with forceSamplerTypeSpecConst disabled and didn't see any issues. But at the same time I don't remember how difficult it was to hit the bug that made me enable that option for the game in the first place so idk, I think I'll just keep the option for it for now.

@K0bin K0bin force-pushed the d3d9-texture-type-mismatch branch from e664f96 to c5b2384 Compare December 10, 2024 20:49
@Blisto91
Copy link
Contributor

Tested a few games without issue

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.

[d3d9][regression?] Alpha Protocol weird reflections
3 participants