Skip to content

GPU: Multiview support - #16350

Draft
ada-tv wants to merge 4 commits into
libsdl-org:mainfrom
ada-tv:feature/gpu-multiview
Draft

ada-tv wants to merge 4 commits into
libsdl-org:mainfrom
ada-tv:feature/gpu-multiview

Conversation

@ada-tv

@ada-tv ada-tv commented Sep 19, 2026

Copy link
Copy Markdown
  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

Allows drawing to multiple slices of array textures with a single render pass, handy for single-pass stereo, cubemaps, and shadow cascades.

I don't actually have any experience using multiview in practice, I was hoping to learn it using the SDL RHI lol

Any pointers from senior devs with more experience are appreciated

  • Integration into testgpu_spinning_cube_xr

API stuff

  • Should BeginMultiViewGPURenderPass take an integer view count (Metal) or a bitmask (Vulkan and D3D)? Assuming view count is the common denominator, going with that
  • View offsets?
  • Behavior of BeginMultiViewGPURenderPass when only given one view
    Just render to the first array slice?
  • Multiview state might need to be set up in graphics pipelines

Backends

  • Vulkan
    • Should KHR_multiview be enabled by default or should we require it to be enabled manually through a property?
      Will expose real max view count if multiview is available, falls back to 1 if not
  • Direct3D 12 (don't have a Windows machine to test with)
  • Metal (don't have a macOS box to test with)

Existing Issue(s)

Closes #16215

Comment thread src/gpu/d3d12/SDL_gpu_d3d12.c Outdated
@flibitijibibo
flibitijibibo self-requested a review September 20, 2026 01:27
@flibitijibibo

Copy link
Copy Markdown
Collaborator

Should KHR_multiview be enabled by default or should we require it to be enabled manually through a property?

If the XR properties are present we can make multiview mandatory, otherwise we can ignore/skip it.

@ada-tv

ada-tv commented Sep 20, 2026

Copy link
Copy Markdown
Author

If the XR properties are present we can make multiview mandatory, otherwise we can ignore/skip it.

For now I'm making it so the max view count is exposed through a device property defaulting to 1, so if an app wants to fall back to another method or quit with an error message it can do so.

Some drivers on Linux either don't support multiview or have only started supporting it relatively recently.

@flibitijibibo

Copy link
Copy Markdown
Collaborator

Latest version of the support query bits lgtm. Once the spinning cube example is updated I'll test on-device ASAP.

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.

GPU Multiview

3 participants