protonscr

Support SetDepthBounds via D3D12GraphicsCommandListExt

vkd3dclosed
HansKristian-Work/vkd3d-proton#827 · opened 2021-10-03 by jp7677 · updated 2021-10-04 · 2 comments · github
Jjp7677 2021-10-03 github

Hi,

Could you please consider adding a new extension method to D3D12GraphicsCommandListExt for SetDepthBounds?

While looking into an issue with Battlefield5 crashing when DXVK-NVAPI is in use (https://github.com/jp7677/dxvk-nvapi/issues/45), logging revealed that the engine (Frostbite) wants to use NVAPI to create graphics pipeline state objects with extension support for SetDepthBounds. Unfortunate the game crashes according to that report when creating graphics pipeline state objects through NVAPI fails. Once this succeeds though, it uses NVAPI to set depth bounds.

Related NVAPI methods:

NvAPI_Status __cdecl NvAPI_D3D12_CreateGraphicsPipelineState(ID3D12Device *pDevice, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pPSODesc, NvU32 numExtensions, const NVAPI_D3D12_PSO_EXTENSION_DESC** ppExtensions, ID3D12PipelineState **ppPSO)

NvAPI_Status __cdecl NvAPI_D3D12_SetDepthBoundsTestValues(ID3D12GraphicsCommandList *pCommandList, const float minDepth, const float maxDepth)

I've clicked together a branch for DXVK-NVAPI that implements those two methods and just ackknowledges SetDepthBounds (https://github.com/jp7677/dxvk-nvapi/pull/46). The game/engine does no longer crashes with that branch when using NVAPI-DXVK, but it would be even better to be able to forward SetDepthBounds into D3D12/VKD3D-Proton, like it is implemented for DXVK or similar to the Cubin extensions for VKD3D-Proton. Eventually this will also yield a tiny bit of extra performance.

Please let me know if more info is needed.

PS: I guess no bump of the interface version (thus D3D12GraphicsCommandListExt1) is needed, since there hasn't been any VKD3D-Proton release since the introduction of that interfaces (I also guess there are no other consumers other than DXVK-NVAPI).

Ddoitsujin maintainer 2021-10-03 github

We already support depth bounds via standard D3D12 methods. I don't know why Nvidia felt the need to reinvent the wheel there, or why Frostbite isn't using this.

Note that creating a pipeline with depth bounds test enabled requires using the somewhat cursed CreatePipelineState API.

Jjp7677 2021-10-04 github

Thanks for the hints, with knowing that, having this as an extension if ofc not needed.

Nothing extracted yet.