[webkit-changes] [WebKit/WebKit] 5b6cb5: [WebXR] Rendering is incorrect in on-device HQ cap...

Dan Glastonbury noreply at github.com
Sun May 19 18:22:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b6cb5049aac2b44d2b928fdaae5e6625075bf89
      https://github.com/WebKit/WebKit/commit/5b6cb5049aac2b44d2b928fdaae5e6625075bf89
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2024-05-19 (Sun, 19 May 2024)

  Changed paths:
    M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.h
    M Source/WebCore/Modules/webxr/WebXROpaqueFramebufferCocoa.cpp
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.mm
    M Source/WebCore/platform/xr/PlatformXR.h
    M Source/WebCore/testing/WebFakeXRDevice.cpp
    M Source/WebKit/Shared/XR/PlatformXR.serialization.in

  Log Message:
  -----------
  [WebXR] Rendering is incorrect in on-device HQ capture
https://bugs.webkit.org/show_bug.cgi?id=274296
rdar://128248238

Reviewed by Mike Wyrzykowski.

When doing on-device HQ capture of WebXR content the rendering is missing the
right eye and the left eye has warping at the edges. This is because
WebXROpaqueFramebuffer was misinterpreting the layered-to-shared layout required
by the Compositor in this mode, where the texture and viewport allocations are
asymmetric.

The core of fixing this was to understand what coordinate space
drawing and blitting operations happen in:
* All drawing to the drawing framebuffer happen in "screen space" of the
  rasterization rate map.
* Blit from shared to layered textures happen in "physical space" of the
  raterization rate map (ie. texture allocation size)

The framebuffer size has been removed from PlatformXR::FrameData::LayerData. The
display framebuffer size is now calculated from the physical sizes instead of
assuming it was twice the width of the framebuffer for layered layout.

Correct viewports in "screen space" are to be passed via
PlatformXR::FrameData::LayerData. Viewport dimensions are no longer converted to
"physical space".

Additionally:
* Fixed incorrectly using screen size (ie. 4065x5886) in
  -(MTLRasterizationRateLayerDescriptor intWithSampleCount:) to save allocating
  ~180MB of storage for a few hundred floats
* Refactor rasterization rate map descriptor data into
  PlatformXR::FrameData::RateMapDescription to make it clear it's intended
  use.
* Remove dead code in WebXROpaqueFramebuffer & GraphicsContextGL.

* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_command_buffer.mm:
(rx::mtl::RenderCommandEncoder::setViewport): Viewport coordinates are in
rasterization rate map "screen space" and don't need conversion.
(rx::mtl::RenderCommandEncoder::setScissorRect): Conversion from physical to
screen coordinates requires rounding to the nearest integer, not floor or ceil.
* Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp:
(WebCore::WebXROpaqueFramebuffer::drawFramebufferSize const):
(WebCore::WebXROpaqueFramebuffer::displayFramebufferSize const): Deleted.
* Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.h:
(WebCore::WebXROpaqueFramebuffer::framebuffer const):
* Source/WebCore/Modules/webxr/WebXROpaqueFramebufferCocoa.cpp:
(WebCore::WebXROpaqueFramebuffer::startFrame):
(WebCore::WebXROpaqueFramebuffer::blitSharedToLayered):
(WebCore::WebXROpaqueFramebuffer::drawFramebufferSize const):
(WebCore::WebXROpaqueFramebuffer::drawViewport const):
(WebCore::calcFramebufferSize):
(WebCore::WebXROpaqueFramebuffer::setupFramebuffer):
(WebCore::WebXROpaqueFramebuffer::displayFramebufferSize const): Deleted.
(WebCore::convertViewportToPhysicalCoordinates): Deleted.
(WebCore::WebXROpaqueFramebuffer::calculateViewportShared): Deleted.
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/cocoa/ANGLEUtilitiesCocoa.mm:
(WebCore::newRasterizationRateMap):
* Source/WebCore/platform/xr/PlatformXR.h: Remove dead code PlatformXR::Layout
* Source/WebCore/testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::frameTimerFired):
* Source/WebKit/Shared/XR/PlatformXR.serialization.in:

Canonical link: https://commits.webkit.org/278975@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list