Files
mitch030504--Wiicompiled_VR…/aurora-main/lib/webgpu/fdm.hpp
T
iChris4andClaude Opus 5.5 cc653272c8 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>
2026-09-24 19:03:17 +02:00

28 lines
1.1 KiB
C++

#pragma once
#include <cstdint>
#include <webgpu/webgpu_cpp.h>
// Fragment density maps for foveated eye rendering, through the ABI of a Dawn built with Aurora's
// patches (include/aurora/dawn_fdm_abi.h, the Quest build). Against any other Dawn the maps are
// simply unavailable.
namespace aurora::webgpu::fdm {
// Before the device is requested: whether to ask Dawn for VK_EXT_fragment_density_map.
void request(bool wanted) noexcept;
// Once the device exists: reads what Dawn enabled, and logs it.
void device_created() noexcept;
bool available() noexcept;
// Framebuffer pixels per density map texel, in each direction.
uint32_t texel_size() noexcept;
// An immutable RG8 map of `width` by `height` texels, or 0. Usable once map_ready.
uint64_t create_map(uint32_t width, uint32_t height, const uint8_t* rg8) noexcept;
bool map_ready(uint64_t map) noexcept;
void release_map(uint64_t map) noexcept;
// Render passes whose first color attachment is `view` get `map` while it is ready; 0 unbinds.
bool bind(const wgpu::TextureView& view, uint64_t map) noexcept;
} // namespace aurora::webgpu::fdm