Title: [285494] trunk/Source/WebCore
Revision
285494
Author
[email protected]
Date
2021-11-09 06:31:38 -0800 (Tue, 09 Nov 2021)

Log Message

Unreviewed, reverting r285436.
https://bugs.webkit.org/show_bug.cgi?id=232878

Broke WPE build

Reverted changeset:

"[WebXR] three.js demos don't work"
https://bugs.webkit.org/show_bug.cgi?id=232798
https://commits.webkit.org/r285436

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285493 => 285494)


--- trunk/Source/WebCore/ChangeLog	2021-11-09 13:53:12 UTC (rev 285493)
+++ trunk/Source/WebCore/ChangeLog	2021-11-09 14:31:38 UTC (rev 285494)
@@ -1,5 +1,18 @@
 2021-11-09  Commit Queue  <[email protected]>
 
+        Unreviewed, reverting r285436.
+        https://bugs.webkit.org/show_bug.cgi?id=232878
+
+        Broke WPE build
+
+        Reverted changeset:
+
+        "[WebXR] three.js demos don't work"
+        https://bugs.webkit.org/show_bug.cgi?id=232798
+        https://commits.webkit.org/r285436
+
+2021-11-09  Commit Queue  <[email protected]>
+
         Unreviewed, reverting r285486.
         https://bugs.webkit.org/show_bug.cgi?id=232876
 

Modified: trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp (285493 => 285494)


--- trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp	2021-11-09 13:53:12 UTC (rev 285493)
+++ trunk/Source/WebCore/Modules/webxr/WebXROpaqueFramebuffer.cpp	2021-11-09 14:31:38 UTC (rev 285494)
@@ -102,20 +102,14 @@
     if (!m_context.graphicsContextGL())
         return;
     auto& gl = *m_context.graphicsContextGL();
-    auto gCGL = static_cast<GraphicsContextGLOpenGL*>(m_context.graphicsContextGL());
-    GCGLenum textureTarget = gCGL->drawingBufferTextureTarget();
-    GCGLenum textureTargetBinding = gCGL->drawingBufferTextureTargetQueryForDrawingTarget(textureTarget);
 
     m_framebuffer->setOpaqueActive(true);
 
     GCGLint boundFBO { 0 };
-    GCGLint boundTexture { 0 };
+
     gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
-    gl.getIntegerv(textureTargetBinding, makeGCGLSpan(&boundTexture, 1));
-
-    auto scopedBindings = makeScopeExit([&gl, boundFBO, boundTexture, textureTarget]() {
+    auto scopedFBOs = makeScopeExit([&gl, boundFBO]() {
         gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
-        gl.bindTexture(textureTarget, boundTexture);
     });
 
     gl.bindFramebuffer(GraphicsContextGL::FRAMEBUFFER, m_framebuffer->object());
@@ -128,6 +122,9 @@
 #if USE(IOSURFACE_FOR_XR_LAYER_DATA)
     ASSERT(data.surface);
 
+    auto gCGL = static_cast<GraphicsContextGLOpenGL*>(m_context.graphicsContextGL());
+    GCGLenum textureTarget = gCGL->drawingBufferTextureTarget();
+
     if (!m_opaqueTexture)
         m_opaqueTexture = gCGL->createTexture();
 
@@ -159,12 +156,11 @@
         return;
     }
 
-    // Set up the framebuffer to use the texture that points to the IOSurface. If we're not multisampling,
-    // the target framebuffer is m_framebuffer->object() (bound above). If we are multisampling, the target
-    // is the resolved framebuffer we created in setupFramebuffer.
-    if (m_multisampleColorBuffer)
-        gl.bindFramebuffer(GL::FRAMEBUFFER, m_resolvedFBO);
-    gl.framebufferTexture2D(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, textureTarget, m_opaqueTexture, 0);
+    // If we're not multisampling, set up the framebuffer to use the texture that points to the IOSurface. The depth and
+    // stencil buffers were attached by setupFramebuffer. If we are multisampling, the framebuffer was initialized in setupFramebuffer,
+    // and we'll resolve into the m_opaqueTexture in endFrame.
+    if (!m_multisampleColorBuffer)
+        gl.framebufferTexture2D(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::TEXTURE_2D, m_opaqueTexture, 0);
 
     // At this point the framebuffer should be "complete".
     ASSERT(gl.checkFramebufferStatus(GL::FRAMEBUFFER) == GL::FRAMEBUFFER_COMPLETE);
@@ -203,21 +199,20 @@
         TemporaryOpenGLSetting scopedStencil(GL::STENCIL_TEST, 0);
 #endif
 
-        GCGLint boundFBO { 0 };
         GCGLint boundReadFBO { 0 };
         GCGLint boundDrawFBO { 0 };
-        gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
         gl.getIntegerv(GL::READ_FRAMEBUFFER_BINDING, makeGCGLSpan(&boundReadFBO, 1));
         gl.getIntegerv(GL::DRAW_FRAMEBUFFER_BINDING, makeGCGLSpan(&boundDrawFBO, 1));
 
-        auto scopedBindings = makeScopeExit([&gl, boundFBO, boundReadFBO, boundDrawFBO]() {
-            gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
+        auto scopedFBOs = makeScopeExit([&gl, boundReadFBO, boundDrawFBO]() {
             gl.bindFramebuffer(GL::READ_FRAMEBUFFER, boundReadFBO);
             gl.bindFramebuffer(GL::DRAW_FRAMEBUFFER, boundDrawFBO);
         });
 
+        gl.bindFramebuffer(GL::DRAW_FRAMEBUFFER, m_resolvedFBO);
+        gl.framebufferTexture2D(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::TEXTURE_2D, m_opaqueTexture, 0);
+
         gl.bindFramebuffer(GL::READ_FRAMEBUFFER, m_framebuffer->object());
-        gl.bindFramebuffer(GL::DRAW_FRAMEBUFFER, m_resolvedFBO);
         gl.blitFramebuffer(0, 0, m_width, m_height, 0, 0, m_width, m_height, GL::COLOR_BUFFER_BIT, GL::NEAREST);
     }
 
@@ -250,13 +245,12 @@
         return false;
     auto& gl = *m_context.graphicsContextGL();
 
-    // Restore bindings when exiting the function.
+    // Bind current FBOs when exiting the function
     GCGLint boundFBO { 0 };
     GCGLint boundRenderbuffer { 0 };
     gl.getIntegerv(GL::FRAMEBUFFER_BINDING, makeGCGLSpan(&boundFBO, 1));
     gl.getIntegerv(GL::RENDERBUFFER_BINDING, makeGCGLSpan(&boundRenderbuffer, 1));
-
-    auto scopedBindings = makeScopeExit([&gl, boundFBO, boundRenderbuffer]() {
+    auto scopedFBO = makeScopeExit([&gl, boundFBO, boundRenderbuffer]() {
         gl.bindFramebuffer(GL::FRAMEBUFFER, boundFBO);
         gl.bindRenderbuffer(GL::RENDERBUFFER, boundRenderbuffer);
     });
@@ -263,6 +257,7 @@
 
     // Set up color, depth and stencil formats
     bool hasDepthOrStencil = m_attributes.stencil || m_attributes.depth;
+    auto colorFormat = m_attributes.alpha ? GL::RGBA8 : GL::RGB8;
 #if USE(OPENGL_ES)
     auto& extensions = reinterpret_cast<ExtensionsGLOpenGLES&>(gl.getExtensions());
     bool platformSupportsPackedDepthStencil = hasDepthOrStencil && extensions.supports("GL_OES_packed_depth_stencil");
@@ -330,7 +325,7 @@
         m_multisampleColorBuffer = gl.createRenderbuffer();
         gl.bindFramebuffer(GL::FRAMEBUFFER, m_framebuffer->object());
         gl.bindRenderbuffer(GL::RENDERBUFFER, m_multisampleColorBuffer);
-        gl.renderbufferStorageMultisample(GL::RENDERBUFFER, m_sampleCount, GL::RGBA8, m_width, m_height);
+        gl.renderbufferStorageMultisample(GL::RENDERBUFFER, m_sampleCount, colorFormat, m_width, m_height);
         gl.framebufferRenderbuffer(GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, GL::RENDERBUFFER, m_multisampleColorBuffer);
         if (hasDepthOrStencil) {
             m_depthStencilBuffer = gl.createRenderbuffer();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to