-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Add support for Direct3D 12 OpenXR backend #104207
base: master
Are you sure you want to change the base?
Conversation
Looking into workflow failures that seem to be due to the use of Update: the clang and MingW build issues are resolved and base workflow passes. |
33fdd8b
to
aa788f3
Compare
I am a little confused by your CI. This workflow with latest push passed all green: https://github.com/mbucchia/godot/actions/runs/13881066387 However the checks below in the PR reflect a CSS error. The details show the formatter replacing Meanwhile your CSS guide (https://docs.godotengine.org/en/latest/contributing/development/cpp_usage_guidelines.html#pragma-once-directive) says:
What am I missing? |
Oh I think I get it - the passing run is from my forked repo. And running the workflow on the Godot repo requires an approval, so the current results are not reflecting the latest push. |
4.x very recently changed to |
Understood. I will change my new files to use the pragmas. Thanks! |
This change adds support for d3d12 rendering devices with OpenXR. This includes querying the adequate adapter to use for XR composition through the use of hooks (similar to what is done in the Vulkan support) and forwarding swapchain images from the OpenXR runtime to the engine.
The function is needed to import textures created by the OpenXR runtime into the rendering backend. The code uses D3D12 introspection methods along with the hints forwarded from the rendering backend to create the necessary texture bookkeeping data.
Many OpenXR runtimes do not use D3D12 as their graphics backend internally but instead import textures into the D3D12 device used for rendering by the engine. These textures are marked with FLAG_ALLOW_SIMULTANEOUS_ACCESS and by definition use automatic layout transitions. The engine shall not use barriers to perform layout transitions on these textures.
Configure multi-view render passes to use a PSO with D3D12 view instancing and output each view to a slice of the render target.
There is a bug in the Direct3D runtime during creation of a PSO with view instancing. If a fragment shader uses front/back face detection built-in variable (SV_IsFrontFace), its signature must include the pixel position built-in variable (SV_Position), otherwise an Internal Runtime error will occur.
Just giving this a first look and all seems pretty good. I don't know the DX12 backend well enough to give any insight on that so will need @clayjohn or @DarioSamo to verify the changes. I'll find some time to do some testing on my end this week. Re your comment here: #86283 (comment) |
Thank you Bastiaan! Please suggest some more testing as well if you want. I saw a couple of XR demo samples, maybe I will give those a shot. If you have a stress test let me know.
I'm a little bit torn yeah. I think you really want to get rid of this warning message that calls specifically incompatibility with WMR today. D3D support was an avenue for that. But also as I mentioned, I don't know if the issue will remain specific to WMR if a platform begins to use D3D12 as its internal gfx API in the future. There is none today AFAICT (most use D3D11 for composition inside the runtime). I might talk some more to the D3D team at Microsoft about these scenarios of "mixed usage" of Agility SDK. Definitely nothing actionable on the current PR though. |
Add support for Direct3D 12 OpenXR backend and rendering with view
instancing (#86283). See godotengine/godot-proposals#10078.
This change adds support for running XR projects built with the
d3d12
rendering backend. The XR backend hooks into the setup for the D3D12
render context in order to use the desired device and command queue for
submission to OpenXR. The XR backend takes care of importing the D3D12
swapchain images into the render context.
As part of this process, three issues are addressed:
that require them.
when front face detection is used.
Please refer to #86283 for additional discussions on the implementation
details.
----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
(remove content below from commit message when squashing this pull request)
For testing, I have been using the https://github.com/GodotVR/godot-xr-template and set it up for D3D12 rendering:
Testing:
--gpu-validation
: PASSI will perform the PENDING scenarios above once we are closer to merging (these scenarios require me to swap GPU).
[1] Disappointingly, there is an issue with WMR and we crash in
xrCreateSwapchain()
pretty inexplicably.Looking into it now, I do not believe it is a bug with this change however.