Skip to content

Commit 392c995

Browse files
committed
Fix xref navigation paths across OpenXR Vulkan Spatial Computing guide and update XrGuidMSFT to XrUuidMSFT
1 parent 0291b93 commit 392c995

82 files changed

Lines changed: 131 additions & 131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

attachments/openxr_engine/renderer_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ bool Renderer::pickPhysicalDevice() {
718718
vk::PhysicalDeviceIDProperties idProps;
719719
vk::PhysicalDeviceProperties2 props2;
720720
props2.pNext = &idProps;
721-
props2 = _device.getProperties2();
721+
_device.getProperties2(&props2);
722722

723723
const uint8_t* requiredLuid = xrContext.getRequiredLUID();
724724
if (requiredLuid && std::memcmp(idProps.deviceLUID, requiredLuid, VK_LUID_SIZE) != 0) {

en/Building_a_Simple_Engine/Tooling/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ This chapter covers essential tooling and techniques for developing, debugging,
1212
* xref:Building_a_Simple_Engine/Tooling/06_packaging_and_distribution.adoc[Packaging and Distribution]
1313
* xref:Building_a_Simple_Engine/Tooling/07_conclusion.adoc[Conclusion]
1414

15-
xref:Subsystems/06_conclusion.adoc[Previous: Subsystems Conclusion] | xref:../index.adoc[Back to Building a Simple Engine]
15+
xref:Building_a_Simple_Engine/Subsystems/06_conclusion.adoc[Previous: Subsystems Conclusion] | xref:Building_a_Simple_Engine/introduction.adoc[Back to Building a Simple Engine]

en/OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/01_introduction.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ If you don't perform this handshake correctly, you might find that you can't ini
2323

2424
By the end of this chapter, you will have modified your engine's initialization code to be fully spatial-aware, laying the groundwork for the predictive frame loop and runtime-owned swapchains that follow.
2525

26-
xref:../introduction.adoc[Previous] | xref:02_system_integration.adoc[Next]
26+
xref:OpenXR_Vulkan_Spatial_Computing/introduction.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/02_system_integration.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/02_system_integration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ By following the `XR_KHR_vulkan_enable2` protocol, we guarantee that our frames
7878

7979
In the next section, we will look at **Hardware Alignment**, where we ensure that the `VkPhysicalDevice` we select is the exact same one the headset is physically connected to.
8080

81-
xref:01_introduction.adoc[Previous] | xref:03_hardware_alignment_luid.adoc[Next]
81+
xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/01_introduction.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/03_hardware_alignment_luid.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/03_hardware_alignment_luid.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ To find the LUID of a Vulkan physical device, we query the `VkPhysicalDeviceIDPr
4040
----
4141
// Iterating through physical devices to find a match
4242
for (const auto& physicalDevice : instance.enumeratePhysicalDevices()) {
43-
auto props2 = physicalDevice.getProperties2<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties>();
44-
auto idProps = props2.get<vk::PhysicalDeviceIDProperties>();
43+
vk::PhysicalDeviceIDProperties idProps;
44+
vk::PhysicalDeviceProperties2 props2;
45+
props2.pNext = &idProps;
46+
physicalDevice.getProperties2(&props2);
4547
4648
if (idProps.deviceLUIDValid) {
4749
// Compare the 8-byte LUID against the target from OpenXR
48-
if (memcmp(idProps.deviceLUID.data(), targetLUID, 8) == 0) {
50+
if (std::memcmp(idProps.deviceLUID, targetLUID, VK_LUID_SIZE) == 0) {
4951
return physicalDevice;
5052
}
5153
}
@@ -60,4 +62,4 @@ Vulkan 1.4 makes this easier by standardizing external memory handles, but these
6062

6163
In the final part of our handshake, we will ensure that our selected device is configured with the mandatory **Vulkan 1.4 features** required for a modern spatial pipeline.
6264

63-
xref:02_system_integration.adoc[Previous] | xref:04_vulkan_1_4_feature_requirements.adoc[Next]
65+
xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/02_system_integration.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/04_vulkan_1_4_feature_requirements.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/04_vulkan_1_4_feature_requirements.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ We have now successfully:
6969

7070
With the handshake complete, we are ready to tackle the most significant architectural change in an XR engine: moving from engine-owned swapchains to **Runtime-Owned Swapchains**.
7171

72-
xref:03_hardware_alignment_luid.adoc[Previous] | xref:05_incorporating_into_the_engine.adoc[Next]
72+
xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/03_hardware_alignment_luid.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/05_incorporating_into_the_engine.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/05_incorporating_into_the_engine.adoc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ public:
4949
5050
// Swapchain Management (Chapter 3)
5151
void createSwapchains(vk::Device device, vk::Format format, vk::Extent2D extent);
52-
std::vector<vk::Image> enumerateSwapchainImages(uint32_t eye);
52+
std::vector<vk::Image> enumerateSwapchainImages();
5353
vk::Extent2D getSwapchainExtent();
5454
vk::Format getSwapchainFormat();
5555
void waitSwapchainImage();
56-
uint32_t acquireSwapchainImage(uint32_t eye);
57-
void releaseSwapchainImage(uint32_t eye);
56+
uint32_t acquireSwapchainImage();
57+
void releaseSwapchainImage();
5858
5959
// Frame Lifecycle (Chapter 5)
6060
XrFrameState waitFrame();
6161
void beginFrame();
62-
void endFrame(const std::array<std::vector<vk::raii::ImageView>, 2>& views);
62+
void endFrame(const std::array<std::vector<vk::ImageView>, 2>& eyeViews);
6363
6464
// View & Projection (Chapter 4 & 11)
6565
void locateViews(XrTime predictedTime);
@@ -131,16 +131,16 @@ In `Renderer::pickPhysicalDevice`, we must ensure we select the GPU that OpenXR
131131
bool Renderer::pickPhysicalDevice() {
132132
// ... enumerate devices ...
133133
134-
vk::PhysicalDeviceIDProperties idProps;
135-
vk::PhysicalDeviceProperties2 props2;
136-
props2.pNext = &idProps;
137-
138134
for (auto& _device : devices) {
139-
_device.getProperties2(&props2);
140-
141135
if (xrMode) {
142136
// Match the LUID provided by OpenXR
143-
if (std::memcmp(idProps.deviceLUID, xrContext.getRequiredLUID(), VK_LUID_SIZE) != 0) {
137+
vk::PhysicalDeviceIDProperties idProps;
138+
vk::PhysicalDeviceProperties2 props2;
139+
props2.pNext = &idProps;
140+
_device.getProperties2(&props2);
141+
142+
const uint8_t* requiredLuid = xrContext.getRequiredLUID();
143+
if (requiredLuid && std::memcmp(idProps.deviceLUID, requiredLuid, VK_LUID_SIZE) != 0) {
144144
continue; // Not the right GPU for XR!
145145
}
146146
}
@@ -149,31 +149,31 @@ bool Renderer::pickPhysicalDevice() {
149149
}
150150
----
151151

152-
=== 3. Enabling Vulkan 1.4 Features
152+
=== 3. Enabling Vulkan 1.3/1.4 Features
153153

154-
In `Renderer::createLogicalDevice`, we must explicitly enable the 1.4 features required for spatial computing:
154+
In `Renderer::createLogicalDevice`, we must explicitly enable the Vulkan 1.3 features required for spatial computing, particularly **Dynamic Rendering** and **Synchronization 2**:
155155

156156
[source,cpp]
157157
----
158158
// renderer_core.cpp
159159
bool Renderer::createLogicalDevice(bool enableValidationLayers) {
160160
// ...
161+
// Enable Vulkan 1.3 features
161162
vk::PhysicalDeviceVulkan13Features vulkan13Features;
162163
vulkan13Features.dynamicRendering = vk::True;
163164
vulkan13Features.synchronization2 = vk::True;
164165
165-
// NEW: OpenXR requires Timeline Semaphores (often a 1.2 feature, standard in 1.4)
166-
vk::PhysicalDeviceTimelineSemaphoreFeatures timelineFeatures;
167-
timelineFeatures.timelineSemaphore = vk::True;
168-
169-
vulkan13Features.pNext = &timelineFeatures;
166+
// Enable Multiview (if in XR mode)
167+
vk::PhysicalDeviceMultiviewFeatures multiviewFeatures;
168+
multiviewFeatures.multiview = xrMode ? vk::True : vk::False;
169+
multiviewFeatures.pNext = &vulkan13Features;
170170
171-
// ... create vk::raii::Device ...
171+
// ... create vk::raii::Device with multiviewFeatures in pNext ...
172172
}
173173
----
174174

175175
== Why These Changes?
176176

177177
By referencing the specific locations in `renderer_core.cpp`, we can see that OpenXR isn't just an "add-on"—it's a **collaborator** in the Vulkan lifecycle. Without the LUID matching in `pickPhysicalDevice`, our engine might initialize on a discrete GPU while the VR headset is tethered to an integrated one, leading to a complete failure to display. Similarly, the extension negotiation ensures that the XR compositor and our engine speak the same "dialect" of Vulkan.
178178

179-
xref:04_vulkan_1_4_feature_requirements.adoc[Previous] | xref:../03_Runtime_Owned_Swapchains/01_introduction.adoc[Next]
179+
xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/04_vulkan_1_4_feature_requirements.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/01_introduction.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/01_introduction.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ This rhythm ensures that we never render into an image that is currently being d
2323

2424
By the end of this chapter, your engine will be able to render its spatial views directly into the headset's compositor buffers, using our existing RAII wrappers while respecting the runtime's ownership.
2525

26-
xref:../02_OpenXR_Vulkan_Handshake/05_incorporating_into_the_engine.adoc[Previous] | xref:02_external_image_negotiation.adoc[Next]
26+
xref:OpenXR_Vulkan_Spatial_Computing/02_OpenXR_Vulkan_Handshake/05_incorporating_into_the_engine.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/02_external_image_negotiation.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/02_external_image_negotiation.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ By negotiating the images this way, we ensure a **Zero-Copy** hand-off. When we
7171

7272
This efficiency is the difference between a high-performance 90Hz experience and a laggy, uncomfortable one. In the next section, we'll see how to wrap these raw Vulkan handles into the engine's `vk::raii` abstractions.
7373

74-
xref:01_introduction.adoc[Previous] | xref:03_raii_resource_integration.adoc[Next]
74+
xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/01_introduction.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/03_raii_resource_integration.adoc[Next]

en/OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/03_raii_resource_integration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ This hybrid approach—using raw handles for external resources and RAII for int
7272

7373
In the next section, we will look at the **Memory Ownership Lifecycle**, where we master the delicate dance of waiting, acquiring, and releasing these images during our frame loop.
7474

75-
xref:02_external_image_negotiation.adoc[Previous] | xref:04_memory_ownership_lifecycle.adoc[Next]
75+
xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/02_external_image_negotiation.adoc[Previous] | xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/04_memory_ownership_lifecycle.adoc[Next]

0 commit comments

Comments
 (0)