# thehhmdb/quad-views-foveated-dx12 architecture

> Architecture diagram of the GitHub repository thehhmdb/quad-views-foveated-dx12, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thehhmdb/quad-views-foveated-dx12
- Repository: https://github.com/thehhmdb/quad-views-foveated-dx12

## Overview

This is an implicit OpenXR API layer that adapts quad-view/foveated-rendering applications for runtimes and headsets that do not natively provide those extensions. The application submits quad-view frames; the layer obtains eye gaze, adjusts inner-view placement, composes the views into stereo output, and forwards work through the active graphics backend. Configuration and compatibility quirks modify that behavior. The README documents these capabilities; sampled excerpts confirm frame timing, injected action handling, gaze-space tracking, swapchain bookkeeping, and D3D12 composition, but do not expose all layer-to-subsystem call sites.

Main entry points: [`openxr-api-layer/layer.cpp`](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/layer.cpp) (Layer dispatch), [`openxr-api-layer/compositor.h`](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/compositor.h) (Compositor interface), [`openxr-api-layer/logic/eye_tracker.cpp`](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/eye_tracker.cpp) (Eye tracker), [`openxr-api-layer/framework/dispatch.cpp`](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/framework/dispatch.cpp) (API dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["OpenXR layer"]
  node_layer["Layer dispatch<br/>[layer.cpp]"]
  node_dispatch["API dispatch<br/>[dispatch.cpp]"]
  node_config["Configuration<br/>[config.cpp]"]
  node_frame["Frame pipeline<br/>[frame_pipeline.cpp]"]
end

subgraph group_tracking["Gaze and views"]
  node_actions["Action manager<br/>[action_manager.cpp]"]
  node_eye["Eye tracker<br/>[eye_tracker.cpp]"]
  node_gaze["Gaze spaces"]
  node_fov["FOV stabilization<br/>[fov_stabilizer.cpp]"]
  node_view["View resolution"]
  node_math["View geometry<br/>[view_math.cpp]"]
end

subgraph group_render["Composition"]
  node_interceptor["Swapchain interception"]
  node_swapchains["Swapchain manager"]
  node_composer["Layer composer<br/>[layer_composer.cpp]"]
  node_compositor["Compositor interface<br/>[compositor.h]"]
  node_d3d11["D3D11 compositor"]
  node_d3d12["D3D12 compositor"]
end

subgraph group_platform["Runtime services"]
  node_graphics["Graphics context"]
end

node_app(("OpenXR application"))
node_runtime(("OpenXR runtime"))
node_device(("Eye-tracking device"))
node_settings["User settings"]

node_app -->|"calls API"| node_dispatch
node_dispatch -->|"dispatches calls"| node_layer
node_layer -->|"forwards OpenXR"| node_runtime
node_layer -->|"manages frames"| node_frame
node_layer -->|"manages actions"| node_actions
node_layer -->|"handles gaze spaces"| node_gaze
node_layer -->|"intercepts swapchains"| node_interceptor
node_layer -->|"composes layers"| node_composer
node_config -->|"reads settings"| node_settings
node_actions -->|"injects gaze actions"| node_eye
node_gaze -->|"queries gaze"| node_eye
node_eye -.->|"reads eye gaze"| node_device
node_interceptor -->|"tracks swapchains"| node_swapchains
node_composer -->|"requests composition"| node_compositor
node_compositor -->|"selects backend"| node_d3d11
node_compositor -->|"selects backend"| node_d3d12
node_d3d11 -->|"uses graphics context"| node_graphics
node_d3d12 -->|"uses graphics context"| node_graphics
node_view -->|"uses view geometry"| node_math
node_fov -->|"stabilizes view FOV"| node_view

click node_layer "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/layer.cpp"
click node_dispatch "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/framework/dispatch.cpp"
click node_config "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/config.cpp"
click node_frame "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/frame_pipeline.cpp"
click node_actions "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/action_manager.cpp"
click node_eye "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/eye_tracker.cpp"
click node_gaze "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/gaze_space_manager.cpp"
click node_fov "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/fov_stabilizer.cpp"
click node_view "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/view_resolution.cpp"
click node_math "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/view_math.cpp"
click node_interceptor "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/swapchain_interceptor.cpp"
click node_swapchains "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/swapchain_manager.cpp"
click node_composer "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/layer_composer.cpp"
click node_compositor "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/compositor.h"
click node_d3d11 "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/d3d11_compositor.cpp"
click node_d3d12 "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/d3d12_compositor.cpp"
click node_graphics "https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/graphics_context.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_layer,node_dispatch,node_config,node_frame,node_settings toneBlue
class node_actions,node_eye,node_gaze,node_fov,node_view,node_math toneAmber
class node_interceptor,node_swapchains,node_composer,node_compositor,node_d3d11,node_d3d12 toneMint
class node_graphics toneRose
class node_app,node_runtime,node_device toneIndigo
```

## Components

### OpenXR layer

- [Layer dispatch](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/layer.cpp): `openxr-api-layer/layer.cpp`
- [API dispatch](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/framework/dispatch.cpp): `openxr-api-layer/framework/dispatch.cpp`
- [Configuration](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/config.cpp): `openxr-api-layer/logic/config.cpp`
- [Frame pipeline](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/frame_pipeline.cpp): `openxr-api-layer/logic/frame_pipeline.cpp`

### Gaze and views

- [Action manager](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/action_manager.cpp): `openxr-api-layer/logic/action_manager.cpp`
- [Eye tracker](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/eye_tracker.cpp): `openxr-api-layer/logic/eye_tracker.cpp`
- [Gaze spaces](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/gaze_space_manager.cpp): `openxr-api-layer/logic/gaze_space_manager.cpp`
- [FOV stabilization](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/fov_stabilizer.cpp): `openxr-api-layer/logic/fov_stabilizer.cpp`
- [View resolution](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/view_resolution.cpp): `openxr-api-layer/logic/view_resolution.cpp`
- [View geometry](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/view_math.cpp): `openxr-api-layer/logic/view_math.cpp`

### Composition

- [Swapchain interception](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/swapchain_interceptor.cpp): `openxr-api-layer/logic/swapchain_interceptor.cpp`
- [Swapchain manager](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/swapchain_manager.cpp): `openxr-api-layer/logic/swapchain_manager.cpp`
- [Layer composer](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/layer_composer.cpp): `openxr-api-layer/logic/layer_composer.cpp`
- [Compositor interface](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/compositor.h): `openxr-api-layer/compositor.h`
- [D3D11 compositor](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/d3d11_compositor.cpp): `openxr-api-layer/d3d11_compositor.cpp`
- [D3D12 compositor](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/d3d12_compositor.cpp): `openxr-api-layer/d3d12_compositor.cpp`

### Runtime services

- [Graphics context](https://github.com/thehhmdb/quad-views-foveated-dx12/blob/main/openxr-api-layer/logic/graphics_context.cpp): `openxr-api-layer/logic/graphics_context.cpp`

### Other components

- **OpenXR application**
- **OpenXR runtime**
- **Eye-tracking device**
- **User settings**

## Connections

- OpenXR application → API dispatch: calls API
- API dispatch → Layer dispatch: dispatches calls
- Layer dispatch → OpenXR runtime: forwards OpenXR
- Layer dispatch → Frame pipeline: manages frames
- Layer dispatch → Action manager: manages actions
- Layer dispatch → Gaze spaces: handles gaze spaces
- Layer dispatch → Swapchain interception: intercepts swapchains
- Layer dispatch → Layer composer: composes layers
- Configuration → User settings: reads settings
- Action manager → Eye tracker: injects gaze actions
- Gaze spaces → Eye tracker: queries gaze
- Eye tracker → Eye-tracking device: reads eye gaze
- Swapchain interception → Swapchain manager: tracks swapchains
- Layer composer → Compositor interface: requests composition
- Compositor interface → D3D11 compositor: selects backend
- Compositor interface → D3D12 compositor: selects backend
- D3D11 compositor → Graphics context: uses graphics context
- D3D12 compositor → Graphics context: uses graphics context
- View resolution → View geometry: uses view geometry
- FOV stabilization → View resolution: stabilizes view FOV
