protonscr

Prevent out of in-shader declared bounds access to uniform arrays in order to prevent undefined behavior

vkd3dclosed
HansKristian-Work/vkd3d-proton#1913 · opened 2024-02-23 by werman · updated 2024-02-23 · 1 comments · github
Wwerman 2024-02-23 github

There was a discussion in https://github.com/doitsujin/dxvk/issues/3861 how to deal with indirect OOB access to uniforms in D3D. And I was told that D3D12 is the same as D3D11 in this regard and games could access constant buffer arrays out of declared in the shader bounds. Such behavior is undefined per Vulkan spec but desktop GPUs don't care about it, however Turnip does care.

The proposed solution in DXVK is to declare all dynamically indexed UBOs with upper size bound of 4096. I see that D3D12 has the same upper bound, so I propose to implement the same solution here. Thoughts?

For now in Turnip we'd have our own workaround for current and old DXVK and for vkd3d-proton.

Wwerman 2024-02-23 github

Discussed this elsewhere, vkd3d-proton already does the right thing.

Upstream links