Skip to content

Commit 3d2f667

Browse files
authored
Merge pull request #431 from gpx1000/update-single-texture-vs-array-texture-swapchains
Update guidance for single texture vs array texture swapchains sections.
2 parents 2912d17 + 6c60fee commit 3d2f667

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

en/OpenXR_Vulkan_Spatial_Computing/04_Dynamic_Rendering/03_stereo_viewport_scissor.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ commandBuffer.setScissor(0, eyeScissor);
4242

4343
== Single-Texture vs. Array-Texture Swapchains
4444

45-
Depending on the XR runtime, we might receive one large "atlas" texture containing both eyes, or an **Array Texture** where each eye has its own layer.
45+
The swapchain's layout isn't handed to us by the runtime as a surprise — *we* choose it up front via `arraySize` in `XrSwapchainCreateInfo` (see xref:OpenXR_Vulkan_Spatial_Computing/03_Runtime_Owned_Swapchains/02_external_image_negotiation.adoc[Runtime-Owned Swapchains]). In practice that leaves two real options:
4646

47-
* **Atlasing**: We use the `x` and `y` offsets of the `vk::Viewport` and `vk::Rect2D` to draw the eyes side-by-side.
48-
* **Array Textures**: We keep the viewport at `(0,0)` but we change the `imageView` layer in our `vk::RenderingAttachmentInfo`.
47+
* **Array Textures** (`arraySize = viewCount`): Both eyes live in one `XrSwapchain` as separate array layers. We keep the viewport at `(0,0)` and select the eye by changing the `imageView` (or `baseArrayLayer`) in our `vk::RenderingAttachmentInfo`. This is what virtually every modern OpenXR runtime expects, and it's the layout required for **Native Multiview** (`VK_KHR_multiview`), covered in xref:OpenXR_Vulkan_Spatial_Computing/08_Slang_Spatial_Shaders/02_native_multiview.adoc[Native Multiview] — where both eyes render in a single draw call instead of a per-eye loop.
48+
* **Single-Texture Atlasing**: An older technique, predating OpenXR, where an application manually composites both eyes side-by-side into one double-wide texture using viewport `x`/`y` offsets. It isn't something a runtime provides for you, and it's incompatible with multiview rendering, so it's a legacy fallback rather than something to design around today.
4949

50-
Dynamic rendering makes it easy to handle both cases by simply adjusting the attachment and viewport parameters. This flexibility allows our engine to support different headset architectures (like wide-FOV headsets vs. mobile VR) without rewriting the render loop.
50+
Because dynamic rendering lets us adjust the attachment and viewport per-draw without touching the pipeline object, moving from a naive per-eye loop to array-texture (and eventually multiview) rendering is a matter of changing which layer we bind, not restructuring the render loop.
5151

5252
== Advanced: Variable Rate Shading and Stencil Masking
5353

0 commit comments

Comments
 (0)