Source/WebCore/ChangeLog

 12021-10-01 Kimmo Kinnunen <kkinnunen@apple.com>
 2
 3 WebGL first clear is lost when scissor is used for preserveDrawingBuffer:true in some conditions
 4 https://bugs.webkit.org/show_bug.cgi?id=230618
 5 <rdar://problem/83668270>
 6
 7 Reviewed by Dean Jackson.
 8
 9 Disable scissor for the duration of the blit from drawing buffer
 10 to display buffer.
 11 Not testable via WebGL conformance test suite as it affects the compositing.
 12
 13 Test: webgl/gl-clear-preserve-drawing-buffer-bug.html
 14
 15 * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
 16 (WebCore::GraphicsContextGLOpenGL::prepareTextureImpl):
 17
1182021-09-30 Kimmo Kinnunen <kkinnunen@apple.com>
219
320 ScopedEGLDefaultDisplay should be removed

Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp

@@void GraphicsContextGLOpenGL::prepareTextureImpl()
529529#else
530530 if (m_preserveDrawingBufferTexture) {
531531 // Blit m_preserveDrawingBufferTexture into m_texture.
 532 TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE);
 533 TemporaryANGLESetting scopedDither(GL_DITHER, GL_FALSE);
532534 gl::BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_preserveDrawingBufferFBO);
533535 gl::BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_fbo);
534536 gl::BlitFramebufferANGLE(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);

LayoutTests/ChangeLog

 12021-10-01 Kimmo Kinnunen <kkinnunen@apple.com>
 2
 3 WebGL first clear is lost when scissor is used for preserveDrawingBuffer:true in some conditions
 4 https://bugs.webkit.org/show_bug.cgi?id=230618
 5 <rdar://problem/83668270>
 6
 7 Reviewed by Dean Jackson.
 8
 9 Add a pixel test to verify that scissor is not applied when blitting drawing buffer
 10 to display buffer in preserveDrawingBuffer: true case.
 11
 12 * webgl/gl-clear-preserve-drawing-buffer-bug-expected.html: Added.
 13 * webgl/gl-clear-preserve-drawing-buffer-bug.html: Added.
 14
1152021-10-01 Kevin Turner <kevin_turner@apple.com>
216
317 Add support for pow(), sqrt() and hypot() per https://drafts.csswg.org/css-values-4/#exponent-funcs.

LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug-expected.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<meta charset="utf-8">
 5<title>Test for WebGL preserve drawing buffer being affected by scissor.</title>
 6<script src="resources/webgl_test_files/js/webgl-test-utils.js"> </script>
 7<style type=text/css>
 8body { margin: 0 }
 9</style>
 10</head>
 11<body>
 12<div style="position: absolute; top: 50px; height: 50px; left: 125px; width: 50px; background-color: lime"></div>
 13<div style="position: absolute; top: 100px; height: 50px; left: 0px; width: 300px; background-color: lime"></div>
 14</body>
 15</html>
 16

LayoutTests/webgl/gl-clear-preserve-drawing-buffer-bug.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<meta charset="utf-8">
 5<title>Test for WebGL preserve drawing buffer being affected by scissor.</title>
 6<script src="resources/webgl_test_files/js/webgl-test-utils.js"> </script>
 7<style type=text/css>
 8body { margin: 0 }
 9</style>
 10</head>
 11<body>
 12<canvas style="width: 300px; height: 150px" id="c"></canvas>
 13<script>
 14"use strict";
 15var wtu = WebGLTestUtils;
 16var c = document.getElementById("c");
 17var scale = window.devicePixelRatio;
 18c.width = Math.floor(300. * scale);
 19c.height = Math.floor(150. * scale);
 20var gl = wtu.create3DContext(c, { preserveDrawingBuffer: true, antialias: false });
 21gl.enable(gl.SCISSOR_TEST);
 22gl.clearColor(0., 1., 0., 1);
 23gl.scissor(0, 0, 300. * scale, 50. * scale);
 24gl.clear(gl.COLOR_BUFFER_BIT);
 25gl.scissor(125 * scale, 50 * scale, 50 * scale, 50 * scale);
 26gl.clear(gl.COLOR_BUFFER_BIT);
 27if (window.testRunner)
 28 window.testRunner.dumpAsText(true);
 29</script>
 30</body>
 31</html>
 32