<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>315274</bug_id>
          
          <creation_ts>2026-05-21 05:00:25 -0700</creation_ts>
          <short_desc>WebGPU+WebXR on visionOS: setScissorRect unusable on XR projection layer</short_desc>
          <delta_ts>2026-05-27 15:19:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebXR</component>
          <version>Safari 26</version>
          <rep_platform>Vision Pro</rep_platform>
          <op_sys>visionOS 26</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin">mvaligursky</reporter>
          <assigned_to name="Mike Wyrzykowski">mwyrzykowski</assigned_to>
          <cc>djg</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>mwyrzykowski</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2212885</commentid>
    <comment_count>0</comment_count>
    <who name="Martin">mvaligursky</who>
    <bug_when>2026-05-21 05:00:25 -0700</bug_when>
    <thetext>### 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&apos;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&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213103</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-05-21 16:39:06 -0700</bug_when>
    <thetext>&lt;rdar://problem/177664498&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213695</commentid>
    <comment_count>2</comment_count>
    <who name="Mike Wyrzykowski">mwyrzykowski</who>
    <bug_when>2026-05-24 13:47:57 -0700</bug_when>
    <thetext> 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213906</commentid>
    <comment_count>3</comment_count>
    <who name="Mike Wyrzykowski">mwyrzykowski</who>
    <bug_when>2026-05-25 12:17:24 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/65631</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2215155</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-05-27 15:19:11 -0700</bug_when>
    <thetext>Committed 314005@main (eda478cddb5d): &lt;https://commits.webkit.org/314005@main&gt;

Reviewed commits have been landed. Closing PR #65631 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>