Title: [278255] trunk/Source/WebCore
Revision
278255
Author
[email protected]
Date
2021-05-30 12:41:32 -0700 (Sun, 30 May 2021)

Log Message

[WebXR] Recommended framebuffer width incorrectly scaled
https://bugs.webkit.org/show_bug.cgi?id=226408
<rdar://problem/78638309>

Reviewed by Tim Horton.

When WebXRWebGLLayer creates the WebXROpaqueFramebuffer, it asks
the session for the recommended framebuffer size. It then
multiplies the width by 2 - I assume because there are two eyes.
However, the specification [1] says that it is a "best estimate of
the WebGL framebuffer resolution large enough to contain all of the
session’s XRViews". So it should be the session that makes account
for the multiple views, not the framebuffer.

Since this would almost certainly break existing content using the OpenXR
backend, I edited the implementation to include the 2x width scale.

* Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::createOpaqueFramebuffer): Remove the "* 2".
* platform/xr/openxr/PlatformXROpenXR.cpp: Add a "* 2" to not break content.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278254 => 278255)


--- trunk/Source/WebCore/ChangeLog	2021-05-30 19:18:56 UTC (rev 278254)
+++ trunk/Source/WebCore/ChangeLog	2021-05-30 19:41:32 UTC (rev 278255)
@@ -1,3 +1,26 @@
+2021-05-30  Dean Jackson  <[email protected]>
+
+        [WebXR] Recommended framebuffer width incorrectly scaled
+        https://bugs.webkit.org/show_bug.cgi?id=226408
+        <rdar://problem/78638309>
+
+        Reviewed by Tim Horton.
+
+        When WebXRWebGLLayer creates the WebXROpaqueFramebuffer, it asks
+        the session for the recommended framebuffer size. It then
+        multiplies the width by 2 - I assume because there are two eyes.
+        However, the specification [1] says that it is a "best estimate of
+        the WebGL framebuffer resolution large enough to contain all of the
+        session’s XRViews". So it should be the session that makes account
+        for the multiple views, not the framebuffer.
+
+        Since this would almost certainly break existing content using the OpenXR
+        backend, I edited the implementation to include the 2x width scale.
+
+        * Modules/webxr/WebXRWebGLLayer.cpp:
+        (WebCore::createOpaqueFramebuffer): Remove the "* 2".
+        * platform/xr/openxr/PlatformXROpenXR.cpp: Add a "* 2" to not break content.
+
 2021-05-30  Darin Adler  <[email protected]>
 
         Remove WTF::Optional synonym for std::optional, using that class template directly instead

Modified: trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp (278254 => 278255)


--- trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp	2021-05-30 19:18:56 UTC (rev 278254)
+++ trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp	2021-05-30 19:41:32 UTC (rev 278255)
@@ -72,7 +72,7 @@
     float scaleFactor = std::clamp(init.framebufferScaleFactor, MinFramebufferScalingFactor, device->maxFramebufferScalingFactor());
 
     IntSize recommendedSize = session.recommendedWebGLFramebufferResolution();
-    auto width = static_cast<uint32_t>(std::ceil(2 * recommendedSize.width() * scaleFactor));
+    auto width = static_cast<uint32_t>(std::ceil(recommendedSize.width() * scaleFactor));
     auto height = static_cast<uint32_t>(std::ceil(recommendedSize.height() * scaleFactor));
 
     // 9.3. Initialize layer’s framebuffer to a new opaque framebuffer with the dimensions framebufferSize

Modified: trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp (278254 => 278255)


--- trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp	2021-05-30 19:18:56 UTC (rev 278254)
+++ trunk/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp	2021-05-30 19:41:32 UTC (rev 278255)
@@ -80,7 +80,7 @@
     auto configType = toXrViewConfigurationType(mode);
     auto viewsIterator = m_configurationViews.find(configType);
     if (viewsIterator != m_configurationViews.end())
-        return { static_cast<int>(viewsIterator->value[0].recommendedImageRectWidth), static_cast<int>(viewsIterator->value[0].recommendedImageRectHeight) };
+        return { static_cast<int>(2 * viewsIterator->value[0].recommendedImageRectWidth), static_cast<int>(viewsIterator->value[0].recommendedImageRectHeight) };
     return Device::recommendedResolution(mode);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to