Vulkan for XR tutorial using Simple Engine#335
Conversation
Add "Incorporating into the Engine" sections demonstrating practical implementation of Variable Rate Shading, Canted Displays, CAVE Architecture, Warp and Blend, LightField Theory, Plenoptic Synthesis, Scene Understanding, ML Inference, Semantic Occlusion, Platform Divergence, and Spatial Diagnostics CI/CD. Include C++ code examples for renderer_core.cpp, renderer_rendering.cpp, and engine.cpp showing feature enablement, pipeline setup, and compute passes using Vulkan 1.4 and Slang shaders.
…igation Add navigation structure for new OpenXR-Vulkan spatial computing guide covering 20 chapters: OpenXR-Vulkan handshake, runtime-owned swapchains, dynamic rendering, predictive frame loop, late latching, action spaces, Slang shaders, quad-views with foveated rendering, variable rate shading, canted displays, CAVE architecture, warp and blend, lightfield theory, plenoptic synthesis, scene understanding, ML inference, semantic occlusion, platform divergence, and spatial diagnostics. Each chapter includes introduction, technical deep-dives, and engine integration sections.
…ration Replace openxr.hpp C++ wrapper with native openxr.h C API throughout xr_context. Add OpenXR::OpenXR alias for openxr_loader target compatibility. Fix memory_pool.cpp source path and Assets copy destination. Load Vulkan extension function pointers explicitly via xrGetInstanceProcAddr. Implement proper LUID extraction from OpenXR-selected physical device using VkPhysicalDeviceIDProperties. Replace XrGuidMSFT with XrUuidMSFT for spatial mesh structure. Update all OpenXR handle types from C++ wrappers to native C types (XrInstance, XrSession, XrSpace, XrAction, XrSwapchain). Convert all OpenXR API calls from method-style to function-style. Initialize views vector with proper XR_TYPE_VIEW structure type.
…e and update XrGuidMSFT to XrUuidMSFT
…llation Add vcpkg PATH resolution using VCPKG_INSTALLATION_ROOT. Add error checking after simple_engine and openxr-loader installation steps. Implement vcpkg caching in GitHub Actions workflow to speed up CI builds. Consolidate vcpkg environment setup into separate step with binary cache configuration.
…Properties2/getFeatures2 Replace manual pNext chaining with type-safe templated Vulkan-Hpp methods for querying PhysicalDeviceIDProperties and PhysicalDevicePresentBarrierFeaturesNV. Update code examples in hardware alignment, CAVE architecture, and renderer_core.cpp to use getProperties2<>/getFeatures2<> with compile-time type specification and .get<>() accessor pattern.
|
That's a pretty comprehensive PR 👍🏻 Will prob. take some time to review this, but at first glance: Can we lower the baseline from Vulkan 1.4 to 1.3? 1.4 didn't add that much, but it has very limited support on mobile. |
SaschaWillems
left a comment
There was a problem hiding this comment.
Did a first quick review. I don't have much experience with OpenXR, but this looks good to me and was easy to follow.
Aside from the comments, I'd like to see links to existing documentation like the tutorial, the spec and/or the guide, making it easier for people to discover relevant adjacent information.
|
CMake setup for the source fails for me, but maybe I'm doing something wrong (I didn't find build instructions for the OpenXR engine variation). When running CMake from the attachments/openxr_engine folder, I get the following errors: |
…atial computing tutorial.
…ration Replace openxr.hpp C++ wrapper with native openxr.h C API throughout xr_context. Add OpenXR::OpenXR alias for openxr_loader target compatibility. Fix memory_pool.cpp source path and Assets copy destination. Load Vulkan extension function pointers explicitly via xrGetInstanceProcAddr. Implement proper LUID extraction from OpenXR-selected physical device using VkPhysicalDeviceIDProperties. Replace XrGuidMSFT with XrUuidMSFT for spatial mesh structure. Update all OpenXR handle types from C++ wrappers to native C types (XrInstance, XrSession, XrSpace, XrAction, XrSwapchain). Convert all OpenXR API calls from method-style to function-style. Initialize views vector with proper XR_TYPE_VIEW structure type.
…s and widgets files.
|
Documentation looks good and the code builds, but it crashes for me inside I get the following validation layer error before the crash: This is on Windows with an RTX 4070 using Meta's OpenXR simulator. |
|
Give that another try. I haven't tried it in Meta's OpenXR simulator,. But it does seem to work in monada runtime and our runtime. I did test it in Windows so hopefully Meta's runtime will be good to go. |
…latform header XR_USE_PLATFORM_WIN32 causes openxr_platform.h to pull in Win32 extension structs that use LARGE_INTEGER and IUnknown. The former is in <windows.h>; the latter is in <unknwn.h> which WIN32_LEAN_AND_MEAN excludes from the windows.h umbrella. Previously xr_context.h hardcoded XR_USE_PLATFORM_XLIB (even on Windows), so the Win32 sections were never compiled. Now that the platform define is correct, add the explicit prerequisite includes.
…s and widgets files.
- Implemented OpenXR session state handling to support session start/stop events. - Integrated an ImGui system for rendering custom UI components. - Enhanced XR frame rendering logic to respect session state. - Added logic to dynamically select XR reference spaces based on platform compatibility. - Updated Vulkan rendering logic to handle ImGui frame closures and pipeline binding conditions. - Prevented GTK modules from loading to avoid crashes on Wayland. - Made several fixes, including fallback rendering when the session isn't running and bindings for XR actions and poses.
…rame rendering reliability.
|
Thanks. It's now starting up. But I do get some validation errors: and And afterwards I do see the Meta XR simulator spinning up, but all I get is a white screen. Last line in std::out is: Then pressing any key results in an assertion; Not sure if any of this is related to the Meta XR Simulator. |
…ove OpenXR session handling. - Removed XR multiview pipeline configurations and updated layer and swapchain logic for simpler rendering. - Integrated pipelineCreationCacheControl and multiview into Vulkan 1.1+ feature structs, aligning with XR runtime requirements. - Improved frame loop reliability by introducing `isSessionFraming` to handle READY state in Monado. - Added reference space sync to align scene and XR environments post-loading. - Updated memory pool to optimize allocation scanning with `nextFreeHint` and freed-space reuse. - Disabled ImGui integration while addressing heap corruption issues. - Refactored session lifecycle handling to reduce busy-spinning, improve stability, and add debug logging. - Improved the Vulkan platform abstraction to include standalone XR headset support.
# Conflicts: # en/Building_a_Simple_Engine/Tooling/index.adoc
Add engine integration sections for spatial computing chapters 10-20
Add "Incorporating into the Engine" sections demonstrating practical implementation of Variable Rate Shading, Canted Displays, CAVE Architecture, Warp and Blend, LightField Theory, Plenoptic Synthesis, Scene Understanding, ML Inference, Semantic Occlusion, Platform Divergence, and Spatial Diagnostics CI/CD. Include C++ code examples for renderer_core.cpp, renderer_rendering.cpp, and engine.cpp showing feature enablement, pipeline setup, and compute passes using Vulkan 1.4 and Slang shaders.
This is a WIP currently, doing this to help test the CI scripts.