Title: [278259] trunk/Source/WebCore
Revision
278259
Author
[email protected]
Date
2021-05-30 15:26:49 -0700 (Sun, 30 May 2021)

Log Message

[WebXR] No need for opaqueTexture when USE(IOSURFACE_FOR_XR_LAYER_DATA)
https://bugs.webkit.org/show_bug.cgi?id=226405
<rdar://problem/78636950>

Reviewed by Tim Horton.

When USE(IOSURFACE_FOR_XR_LAYER_DATA) is true, we'll get our
textures via a different method - we'll create them based on an
IOSurface we receive. This means that when we're in a
USE(IOSURFACE_FOR_XR_LAYER_DATA) configuration, we don't need the
opaqueTexture property on FrameData.

* platform/xr/PlatformXR.h: Put opaqueTexture in the #else clause.
(PlatformXR::Device::FrameData::LayerData::encode const):
(PlatformXR::Device::FrameData::LayerData::decode):
* testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::frameTimerFired):
* Modules/webxr/WebXROpaqueFramebuffer.cpp: Guard use of opaqueTexture.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278258 => 278259)


--- trunk/Source/WebCore/ChangeLog	2021-05-30 21:36:53 UTC (rev 278258)
+++ trunk/Source/WebCore/ChangeLog	2021-05-30 22:26:49 UTC (rev 278259)
@@ -1,5 +1,26 @@
 2021-05-30  Dean Jackson  <[email protected]>
 
+        [WebXR] No need for opaqueTexture when USE(IOSURFACE_FOR_XR_LAYER_DATA)
+        https://bugs.webkit.org/show_bug.cgi?id=226405
+        <rdar://problem/78636950>
+
+        Reviewed by Tim Horton.
+
+        When USE(IOSURFACE_FOR_XR_LAYER_DATA) is true, we'll get our
+        textures via a different method - we'll create them based on an
+        IOSurface we receive. This means that when we're in a
+        USE(IOSURFACE_FOR_XR_LAYER_DATA) configuration, we don't need the
+        opaqueTexture property on FrameData.
+
+        * platform/xr/PlatformXR.h: Put opaqueTexture in the #else clause.
+        (PlatformXR::Device::FrameData::LayerData::encode const):
+        (PlatformXR::Device::FrameData::LayerData::decode):
+        * testing/WebFakeXRDevice.cpp:
+        (WebCore::SimulatedXRDevice::frameTimerFired):
+        * Modules/webxr/WebXROpaqueFramebuffer.cpp: Guard use of opaqueTexture.
+
+2021-05-30  Dean Jackson  <[email protected]>
+
         [WebXR] invalidateFramebuffer is not the same as clearing contents
         https://bugs.webkit.org/show_bug.cgi?id=226422
         <rdar://problem/78652351>

Modified: trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp (278258 => 278259)


--- trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp	2021-05-30 21:36:53 UTC (rev 278258)
+++ trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp	2021-05-30 22:26:49 UTC (rev 278259)
@@ -90,7 +90,6 @@
 
 void WebXROpaqueFramebuffer::startFrame(const PlatformXR::Device::FrameData::LayerData& data)
 {
-    m_opaqueTexture = data.opaqueTexture;
     if (!m_context.graphicsContextGL())
         return;
     auto& gl = *m_context.graphicsContextGL();
@@ -111,6 +110,12 @@
     // FIXME: Actually do the clearing (not using invalidateFramebuffer). This will have to be done after we've attached
     // the textures/renderbuffers.
 
+#if USE(IOSURFACE_FOR_XR_LAYER_DATA)
+    UNUSED_PARAM(data);
+#else
+    m_opaqueTexture = data.opaqueTexture;
+#endif
+
 #if USE(OPENGL_ES)
     auto& extensions = reinterpret_cast<ExtensionsGLOpenGLES&>(gl.getExtensions());
     if (m_attributes.antialias && extensions.isImagination()) {

Modified: trunk/Source/WebCore/platform/xr/PlatformXR.h (278258 => 278259)


--- trunk/Source/WebCore/platform/xr/PlatformXR.h	2021-05-30 21:36:53 UTC (rev 278258)
+++ trunk/Source/WebCore/platform/xr/PlatformXR.h	2021-05-30 22:26:49 UTC (rev 278259)
@@ -171,9 +171,10 @@
         };
 
         struct LayerData {
-            PlatformGLObject opaqueTexture { 0 };
 #if USE(IOSURFACE_FOR_XR_LAYER_DATA)
             std::unique_ptr<WebCore::IOSurface> surface;
+#else
+            PlatformGLObject opaqueTexture { 0 };
 #endif
 
             template<class Encoder> void encode(Encoder&) const;
@@ -429,10 +430,11 @@
 template<class Encoder>
 void Device::FrameData::LayerData::encode(Encoder& encoder) const
 {
-    encoder << opaqueTexture;
 #if USE(IOSURFACE_FOR_XR_LAYER_DATA)
     WTF::MachSendRight surfaceSendRight = surface ? surface->createSendRight() : WTF::MachSendRight();
     encoder << surfaceSendRight;
+#else
+    encoder << opaqueTexture;
 #endif
 }
 
@@ -440,13 +442,14 @@
 std::optional<Device::FrameData::LayerData> Device::FrameData::LayerData::decode(Decoder& decoder)
 {
     PlatformXR::Device::FrameData::LayerData layerData;
-    if (!decoder.decode(layerData.opaqueTexture))
-        return std::nullopt;
 #if USE(IOSURFACE_FOR_XR_LAYER_DATA)
     WTF::MachSendRight surfaceSendRight;
     if (!decoder.decode(surfaceSendRight))
         return std::nullopt;
     layerData.surface = WebCore::IOSurface::createFromSendRight(WTFMove(surfaceSendRight), WebCore::DestinationColorSpace::SRGB());
+#else
+    if (!decoder.decode(layerData.opaqueTexture))
+        return std::nullopt;
 #endif
     return layerData;
 }

Modified: trunk/Source/WebCore/testing/WebFakeXRDevice.cpp (278258 => 278259)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	2021-05-30 21:36:53 UTC (rev 278258)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	2021-05-30 22:26:49 UTC (rev 278259)
@@ -144,8 +144,13 @@
     FrameData data = ""
     data.shouldRender = true;
 
-    for (auto& layer : m_layers)
+    for (auto& layer : m_layers) {
+#if USE(IOSURFACE_FOR_XR_LAYER_DATA)
+        data.layers.add(layer.key, FrameData::LayerData { });
+#else
         data.layers.add(layer.key, FrameData::LayerData { .opaqueTexture = layer.value });
+#endif
+    }
 
     for (auto& input : m_inputConnections) {
         if (input->isConnected())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to