HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.75k stars 184 forks source link

vkd3d: Introduce interface for creating d3d12 resources from VkImages #1972

Closed yshui closed 2 months ago

yshui commented 2 months ago

Motivation for adding this is to support OpenXR extension XR_KHR_D3D12_enable.

The way OpenXR is designed, the application gets an array of swapchain images from the runtime, and renders into them. (Unlike OpenVR, with which the application will submit textures to be displayed in the VR environment). This means we need to convert the VkImages we get on the unix side to ID3D12Resources on the PE side.


I hope I am doing this correctly. I tried the hello_xr demo on D3D12 which works, and I didn't see any warnings from the validation layer.

gofman commented 2 months ago

Not sure if that is related here, but it looks like we are also missing queue index from ID3D12DXVKInteropDevice::GetVulkanQueueInfo which we need to pass to OpenXR (and we have that from IDXGIVkInteropDevice2 from dxvk / d3d11). I am not sure if that should be considered as an independent change and PR, if not maybe worth adding at once some way?

HansKristian-Work commented 2 months ago

ID3D12DXVKInteropDevice::GetVulkanQueueInfo which we need to pass to OpenXR (and we have that from IDXGIVkInteropDevice2 from dxvk / d3d11)

If DXVK added further revisions of that interface, there's no problem adding that to vkd3d-proton too. I don't mind it being in same PR as long as it's in separate commits as usual.