Title: [283979] trunk
Revision
283979
Author
[email protected]
Date
2021-10-12 05:36:10 -0700 (Tue, 12 Oct 2021)

Log Message

WebGL first clear is lost when scissor is used for preserveDrawingBuffer:true in some conditions
https://bugs.webkit.org/show_bug.cgi?id=230618
<rdar://problem/83668270>

Patch by Kimmo Kinnunen <[email protected]> on 2021-10-12
Reviewed by Dean Jackson.

Source/WebCore:

Disable scissor for the duration of the blit from drawing buffer
to display buffer.
Not testable via WebGL conformance test suite as it affects the compositing.

Test: webgl/gl-clear-preserve-drawing-buffer-bug.html

* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::prepareTextureImpl):

LayoutTests:

Add a pixel test to verify that scissor is not applied when blitting drawing buffer
to display buffer in preserveDrawingBuffer: true case.

* webgl/gl-clear-preserve-drawing-buffer-bug-expected.html: Added.
* webgl/gl-clear-preserve-drawing-buffer-bug.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283978 => 283979)


--- trunk/LayoutTests/ChangeLog	2021-10-12 11:02:40 UTC (rev 283978)
+++ trunk/LayoutTests/ChangeLog	2021-10-12 12:36:10 UTC (rev 283979)
@@ -1,3 +1,17 @@
+2021-10-12  Kimmo Kinnunen  <[email protected]>
+
+        WebGL first clear is lost when scissor is used for preserveDrawingBuffer:true in some conditions
+        https://bugs.webkit.org/show_bug.cgi?id=230618
+        <rdar://problem/83668270>
+
+        Reviewed by Dean Jackson.
+
+        Add a pixel test to verify that scissor is not applied when blitting drawing buffer
+        to display buffer in preserveDrawingBuffer: true case.
+
+        * webgl/gl-clear-preserve-drawing-buffer-bug-expected.html: Added.
+        * webgl/gl-clear-preserve-drawing-buffer-bug.html: Added.
+
 2021-10-11  Arcady Goldmints-Orlov  <[email protected]>
 
         [GLIB] Update test expectations for failing CSS tests.

Added: trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug-expected.html (0 => 283979)


--- trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug-expected.html	2021-10-12 12:36:10 UTC (rev 283979)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test for WebGL preserve drawing buffer being affected by scissor.</title>
+<script src="" </script>
+<style type=text/css>
+body { margin: 0 }
+</style>
+</head>
+<body>
+<div style="position: absolute; top: 50px; height: 50px; left: 125px; width: 50px; background-color: lime"></div>
+<div style="position: absolute; top: 100px; height: 50px; left: 0px; width: 300px; background-color: lime"></div>
+</body>
+</html>
+

Added: trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug.html (0 => 283979)


--- trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug.html	2021-10-12 12:36:10 UTC (rev 283979)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test for WebGL preserve drawing buffer being affected by scissor.</title>
+<script src="" </script>
+<style type=text/css>
+body { margin: 0 }
+</style>
+</head>
+<body>
+<canvas style="width: 300px; height: 150px" id="c"></canvas>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var c = document.getElementById("c");
+var scale = window.devicePixelRatio;
+c.width = Math.floor(300. * scale);
+c.height = Math.floor(150. * scale);
+var gl = wtu.create3DContext(c, { preserveDrawingBuffer: true, antialias: false });
+gl.enable(gl.SCISSOR_TEST);
+gl.clearColor(0., 1., 0., 1);
+gl.scissor(0, 0, 300. * scale, 50. * scale);
+gl.clear(gl.COLOR_BUFFER_BIT);
+gl.scissor(125 * scale, 50 * scale, 50 * scale, 50 * scale);
+gl.clear(gl.COLOR_BUFFER_BIT);
+if (window.testRunner)
+    window.testRunner.dumpAsText(true);
+</script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (283978 => 283979)


--- trunk/Source/WebCore/ChangeLog	2021-10-12 11:02:40 UTC (rev 283978)
+++ trunk/Source/WebCore/ChangeLog	2021-10-12 12:36:10 UTC (rev 283979)
@@ -1,3 +1,20 @@
+2021-10-12  Kimmo Kinnunen  <[email protected]>
+
+        WebGL first clear is lost when scissor is used for preserveDrawingBuffer:true in some conditions
+        https://bugs.webkit.org/show_bug.cgi?id=230618
+        <rdar://problem/83668270>
+
+        Reviewed by Dean Jackson.
+
+        Disable scissor for the duration of the blit from drawing buffer
+        to display buffer.
+        Not testable via WebGL conformance test suite as it affects the compositing.
+
+        Test: webgl/gl-clear-preserve-drawing-buffer-bug.html
+
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLOpenGL::prepareTextureImpl):
+
 2021-10-12  Tim Nguyen  <[email protected]>
 
         Use isSameOriginAsTopDocument() in DocumentLoader::shouldOpenExternalURLsPolicyToPropagate

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (283978 => 283979)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2021-10-12 11:02:40 UTC (rev 283978)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2021-10-12 12:36:10 UTC (rev 283979)
@@ -530,6 +530,8 @@
 #else
     if (m_preserveDrawingBufferTexture) {
         // Blit m_preserveDrawingBufferTexture into m_texture.
+        TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE);
+        TemporaryANGLESetting scopedDither(GL_DITHER, GL_FALSE);
         gl::BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_preserveDrawingBufferFBO);
         gl::BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_fbo);
         gl::BlitFramebufferANGLE(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to