Skip to content
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

Adds support for structextends #136

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

artumino
Copy link

@artumino artumino commented Jun 4, 2023

Handles "structextends" similarly to how ash does it.

I identify a series of root structs, referenced by at least another one through their "structextends" attribute.
Each root struct defines an extension trait and a generic push_next method over the extension trait that allows adding members to the pointer chain.
Structs that have a "structextends" attribute implement the extension trait of the structure they are extending which allows them to be chained.

In the case of polymorphic structs, I use a similar approach by defining an extension trait that will be implemented by every extension struct and a push_next trait that will be implemented by each child.

This allows submitting an additional CompositionLayerDepthInfoKHR to composition layer views, or additional layer info like application space warp info.

Example code for depth submission:

let mut depth_info = openxr::CompositionLayerDepthInfoKHR::new()
        .sub_image(
            openxr::SwapchainSubImage::new()
                .swapchain(depth_swapchain.internal())
                .image_array_index(0)
                .image_rect(rect),
        )
        .max_depth(1.0)
        .min_depth(0.0)
        .far_z(cameras[0].far)
        .near_z(cameras[0].near);
   
openxr::CompositionLayerProjectionView::new()
        .push_next(&mut depth_info)
        .pose(views[0].pose)
        .fov(views[0].fov)
        .sub_image(
            openxr::SwapchainSubImage::new()
                .swapchain(color_swapchain.internal())
                .image_array_index(0)
                .image_rect(rect),
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant