{"id":20597943,"url":"https://github.com/philpax/wgpu-openxr-example","last_synced_at":"2025-07-14T23:11:07.995Z","repository":{"id":62711714,"uuid":"541858167","full_name":"philpax/wgpu-openxr-example","owner":"philpax","description":"a barebones example of how to integrate OpenXR with wgpu (Vulkan-only)","archived":false,"fork":false,"pushed_at":"2023-05-17T04:48:37.000Z","size":195,"stargazers_count":54,"open_issues_count":11,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-04T17:13:42.435Z","etag":null,"topics":["openxr","vulkan","wgpu"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philpax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-27T01:45:54.000Z","updated_at":"2025-06-26T23:24:36.000Z","dependencies_parsed_at":"2025-04-16T04:17:22.116Z","dependency_job_id":null,"html_url":"https://github.com/philpax/wgpu-openxr-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/philpax/wgpu-openxr-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philpax%2Fwgpu-openxr-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philpax%2Fwgpu-openxr-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philpax%2Fwgpu-openxr-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philpax%2Fwgpu-openxr-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philpax","download_url":"https://codeload.github.com/philpax/wgpu-openxr-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philpax%2Fwgpu-openxr-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265366092,"owners_count":23753449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openxr","vulkan","wgpu"],"created_at":"2024-11-16T08:24:33.259Z","updated_at":"2025-07-14T23:11:07.972Z","avatar_url":"https://github.com/philpax.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wgpu-openxr-example\n\na barebones example of how to integrate OpenXR with wgpu (Vulkan-only)\n\nIt has four modes:\n\n- `cargo run --no-default-features`: desktop-only, renders the scene without _any_ XR integration\n- `cargo run -- desktop`: build with XR support, but render the scene without initialising XR\n- `cargo run -- desktop-with-xr-resolution`: build with XR support, initialise XR, but do not render to headset\n- `cargo run -- xr`: build with XR support, and render to the headset\n\nThese modes are intended to show you how to gracefully integrate XR into your project's code\nand how you can move from one stage of integration to the next.\n\nNote that this code is not production-quality; there are a few shortcuts that have been taken\nin the interest of keeping it simple and relatively modular. Make sure to clean up your resources\nproperly and use robust code where possible :)\n\n## Rendering flow\n\nThe code renders three instances of a triangle (two being the controllers) to a multi-view render target.\n\n- In desktop mode, this render target is then blitted to the swapchain, and the user can select which view\n  to look at using the arrow keys.\n- In desktop with XR resolution mode, much the same occurs, except the window is resized to the XR headset's\n  render resolution.\n- In XR mode, the program synchronises with the headset and blits the multi-view render target to the\n  headset as well.\n\nRendering to a render target is necessary to accommodate these:\n\n- Showing what the user is seeing within the desktop window, without having to re-render the scene\n- Decoupling the colour formats of the various display surfaces; wgpu (on my machine) will offer\n  `BGRA8888`, while my OpenXR runtime offers `RGBA8888`.\n\n## Future\n\nIt should theoretically be possible to do the following:\n\n- D3D11/12 backend with OpenXR\n- WebGL2 backend with WebXR\n- Metal backend with ARKit\n\n## Reference\n\nCobbled together from the following sources:\n\n- \u003chttps://github.com/gfx-rs/wgpu-rs/blob/7501ba1311c45c57cf4e361556ab46431478adb4/examples/hello-vr-triangle/main.rs\u003e\n- \u003chttps://github.com/gfx-rs/wgpu/blob/b65ebb4b308228287cdb559b624ce3ac3ba71bd2/wgpu/examples/hello-triangle/main.rs\u003e\n- \u003chttps://github.com/Ralith/openxrs/blob/a6a7d9c00afc5b8d9aa9eb19c692aaf1a7fa6d16/openxr/examples/vulkan.rs\u003e\n- \u003chttps://github.com/gfx-rs/wgpu/blob/b65ebb4b308228287cdb559b624ce3ac3ba71bd2/wgpu-hal/src/vulkan/adapter.rs\u003e\n- \u003chttps://github.com/gfx-rs/wgpu/blob/b65ebb4b308228287cdb559b624ce3ac3ba71bd2/wgpu-hal/src/vulkan/instance.rs\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilpax%2Fwgpu-openxr-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilpax%2Fwgpu-openxr-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilpax%2Fwgpu-openxr-example/lists"}