This implements a new way to be able to manage xr resources easily, as well as guarantee sync rules in both pipelined, and unpipelined rendering, guaranteeing that resources will go to both worlds in the same frame always, even when pipelined rendering is enabled.
Create a new type that implements OxrSessionResourceCreator. This type should have an uninitialized state. update is the method that will initialize the resource with &mut World access. SessionResourceCreators are automatically ordered so that you have access to any other session resource creators that were initialized on the app before yours. in other words, the last session resource creator added should have access to every other session resource
you can then use the remaining methods to control what goes into the render world, and main world. adding methods to then drop those resources also allows automatic destruction of XR objects.
finally, use the add_xr_resource_creator or init_xr_resource_creator method on App to add the resource creator.
code to check for implementation examples
check reference_space.rs for a simple example of how this works with reference spaces.
session.rs is a good decently complex example implementation with comments.
line 100 for trait declaration
line 359 for session implementation
lastly, see how the swapchain and graphics info are created in render.rs
This implements a new way to be able to manage xr resources easily, as well as guarantee sync rules in both pipelined, and unpipelined rendering, guaranteeing that resources will go to both worlds in the same frame always, even when pipelined rendering is enabled.
OxrSessionResourceCreator
. This type should have an uninitialized state.update
is the method that will initialize the resource with&mut World
access. SessionResourceCreators are automatically ordered so that you have access to any other session resource creators that were initialized on the app before yours. in other words, the last session resource creator added should have access to every other session resourceadd_xr_resource_creator
orinit_xr_resource_creator
method onApp
to add the resource creator.code to check for implementation examples
reference_space.rs
for a simple example of how this works with reference spaces.session.rs
is a good decently complex example implementation with comments.render.rs