Added foveated rendering for the Quest

- Eyes render under a VK_EXT_fragment_density_map: full rate around each eye's forward direction,
  2x2 then 4x4 pixel blocks towards the edges ([vr] foveation = off|low|medium|high, default off).
  XR_FB_foveation cannot help here: the runtime's maps only shape passes drawing into its
  swapchain, and the eyes reach it through a copy.
- aurora-main/patches/dawn/aurora_fdm.inc: Dawn enables the extension only on request and for
  dynamic rendering, flags every render pipeline, and chains an immutable RG8 map into any pass
  whose first color attachment is a view bound to one (ABI: include/aurora/dawn_fdm_abi.h).
- android/Build-QuestDawn.ps1 builds the pinned Dawn revision with those patches for arm64
  (dawn-build CI flags, protobuf off) into a cached package; Build-Quest.ps1 links it
  (-StockDawn opts out) and AuroraDawnProvider.cmake enables the ABI from its manifest.
- lib/gfx/foveation.hpp generates the maps (32 px per texel, densities 255/127/63); an eye is
  foveated only when single_pass_eyes draws it in one render pass. Menus never are.
- Live level from the headset panel's VR tab and the launcher; the launch decides whether the
  device has maps. debug.wiicompiled.foveation and debug.wiicompiled.fdm for A/B.
- Tests: Foveation cases in gx_fifo_tests, mkw_vr_config_tests. Docs: OPENXR.md, quest-port.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
iChris4andClaude Opus 5.5 committed 2026-09-24 19:03:17 +02:00
1 parent ceeeba0332
commit cc653272c8
30 files changed
+1527 -14

No files matched your search

+11 -1
View File
@@ -221,6 +221,8 @@ static std::atomic_bool g_stereoSkipCopyClears{true};
// Replays each eye in as few render passes as its clears allow (eye_pass_plan.hpp) rather than one
// per recorded pass. Same image, fewer tile loads and stores.
static std::atomic_bool g_stereoSinglePassEyes{true};
// foveation::Level of the immersive eyes.
static std::atomic_uint32_t g_stereoFoveation{0};
void set_stereo_stop_at_display_copy(bool value) noexcept {
g_stereoStopAtDisplayCopy.store(value, std::memory_order_relaxed);
@@ -234,6 +236,10 @@ void set_stereo_single_pass_eyes(bool value) noexcept {
g_stereoSinglePassEyes.store(value, std::memory_order_relaxed);
}
bool get_stereo_single_pass_eyes() noexcept { return g_stereoSinglePassEyes.load(std::memory_order_relaxed); }
void set_stereo_foveation(uint32_t level) noexcept {
g_stereoFoveation.store(level, std::memory_order_relaxed);
}
uint32_t get_stereo_foveation() noexcept { return g_stereoFoveation.load(std::memory_order_relaxed); }
// The fixed virtual screen orthographic draws are placed on during immersive
// replay, in game world units. Written from the settings overlay and read by
@@ -1789,6 +1795,10 @@ static void render_eye_planned(std::vector<RenderPass>& renderPasses, wgpu::Comm
const bool stereoStencil = target.depthFormat == wgpu::TextureFormat::Depth24PlusStencil8;
const GpuTimingCategory timingCategory =
invocation.stereoEye == 0 ? GpuTimingCategory::EyeLeft : GpuTimingCategory::EyeRight;
// Foveated only as a single render pass: loading a finished eye back under a density map costs a
// full tile load per split, which is what made foveation a net loss in DolphinXR.
const wgpu::TextureView& colorView =
target.foveatedColorView && plan.renderPasses == 1 ? target.foveatedColorView : target.colorView;
wgpu::RenderPassEncoder pass;
for (const auto& step : plan.steps) {
const auto& passInfo = renderPasses[step.pass];
@@ -1797,7 +1807,7 @@ static void render_eye_planned(std::vector<RenderPass>& renderPasses, wgpu::Comm
pass.End();
}
const wgpu::RenderPassColorAttachment colorAttachment{
.view = target.colorView,
.view = colorView,
.resolveTarget = target.resolveView,
.loadOp = step.clearColor ? wgpu::LoadOp::Clear : wgpu::LoadOp::Load,
.storeOp = wgpu::StoreOp::Store,