# MRPS v6 Quest GPU depth fix

This build fixes the Quest error:

> Unable to obtain XRCPUDepthInformation in `gpu-optimized` usage mode.

## Cause

WebXR has two depth access paths:

- `cpu-optimized`: call `XRFrame.getDepthInformation(view)` and copy `XRCPUDepthInformation.data`.
- `gpu-optimized`: call `XRWebGLBinding.getDepthInformation(view)` and sample `XRWebGLDepthInformation.texture`.

Quest can select `gpu-optimized`. The v5 file still called the CPU API, so it failed as soon as real Quest depth was available.

## Fix

- Requests `usagePreference: ['cpu-optimized', 'gpu-optimized']`.
- Keeps `luminance-alpha` as the requested data format.
- If the session reports `gpu-optimized`, it uses `XRWebGLBinding.getDepthInformation(view)`.
- Copies the GPU depth texture into a CPU `Uint16Array` through a small shader and `readPixels`.
- Handles 2D depth textures and WebGL2 texture-array depth textures.
- Keeps the same MRD1 native-depth PNG chunks: `mdPN`, `mdPL`, `mdPR`.
- Metadata now records whether each view came from the CPU path or GPU path.
- No synthetic or demo depth is used.

## Important limitation

The GPU readback path currently supports `luminance-alpha` depth. If a browser returns GPU `float32` depth, this build will stop with a clear error instead of silently producing wrong metric data.

## Files

- `quest_3_mr_phase_shift_encoder_quest_gpu_fixed_v6.html` — fixed encoder.
- `quest_3_mr_phase_shift_encoder_quest_gpu_fixed_v6.diff` — patch against v5.
- `MRPS_v6_VALIDATION.txt` — static validation notes.
