Bug 315274
| Summary: | WebGPU+WebXR on visionOS: setScissorRect unusable on XR projection layer | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Martin <mvaligursky> |
| Component: | WebXR | Assignee: | Mike Wyrzykowski <mwyrzykowski> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | djg, kkinnunen, mwyrzykowski, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 26 | ||
| Hardware: | Vision Pro | ||
| OS: | visionOS 26 | ||
Martin
### Environment
- WebXR (immersive-vr) + WebGPU via XRGPUBinding
### Bug
Creating a projection layer yields:
- colorTexture (attachment) extent: e.g. 1888×1792
- subImage.viewport: e.g. 4338×3478 (larger than the attachment)
setViewport works fine with either size — including the oversized view extent.
setScissorRect cannot be used at all:
- setScissorRect(0, 0, 1888, 1792) // attachment size → renders only into top-left ~1/3 of the eye ❌
- setScissorRect(0, 0, 4338, 3478) // view size → WebGPU validation error (scissor must fit attachment) ❌
- no setScissorRect call // default → renders full eye ✅
Per WebGPU spec, scissor starts at the full attachment, so the attachment-sized call
should be a no-op equivalent to omitting it. On visionOS the explicit call appears to
be interpreted as a positional hint for the compositor's mapping of the layer texture
to the eye display.
### Impact
WebGPU engines that call setScissorRect as part of standard pass setup (PlayCanvas in this case)
render into a sub-rectangle of the eye on AVP. Engines/samples
that happen not to call it (Toji's vr-barebones, webgpu-metaballs) render correctly.
Current workaround: suppress setScissorRect entirely on the XR path.
### Repro
WebXR-Samples vr-barebones.html with one added setScissorRect call before the draw reproduces it.
https://github.com/immersive-web/webxr-samples
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/177664498>
Mike Wyrzykowski
setScissorRect(0, 0, 1888, 1792) // attachment size
is correct based on the WebGPU specification as x, y, width, height are in pixels - I will fix this up
Mike Wyrzykowski
Pull request: https://github.com/WebKit/WebKit/pull/65631
EWS
Committed 314005@main (eda478cddb5d): <https://commits.webkit.org/314005@main>
Reviewed commits have been landed. Closing PR #65631 and removing active labels.