Modified: branches/safari-604-branch/LayoutTests/ChangeLog (223640 => 223641)
--- branches/safari-604-branch/LayoutTests/ChangeLog 2017-10-18 23:41:44 UTC (rev 223640)
+++ branches/safari-604-branch/LayoutTests/ChangeLog 2017-10-18 23:52:38 UTC (rev 223641)
@@ -1,3 +1,21 @@
+2017-10-17 Dean Jackson <[email protected]>
+
+ Cherry-pick r223567. rdar://problem/35041476
+
+ 2017-10-16 Dean Jackson <[email protected]>
+
+ WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas
+ https://bugs.webkit.org/show_bug.cgi?id=178223
+ <rdar://problem/34597567>
+
+ Reviewed by Antoine Quint.
+
+ Test that resizes an already large buffer to make sure it
+ doesn't get clamped to 4k.
+
+ * fast/canvas/webgl/large-drawing-buffer-resize-expected.txt: Added.
+ * fast/canvas/webgl/large-drawing-buffer-resize.html: Added.
+
2017-10-17 Jason Marcell <[email protected]>
Cherry-pick r223313. rdar://problem/35042269
Added: branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt (0 => 223641)
--- branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt 2017-10-18 23:52:38 UTC (rev 223641)
@@ -0,0 +1,5 @@
+Original drawing buffer: 5000 x 5000
+
+Resized drawing buffer: 5001 x 5001
+
+
Property changes on: branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt
___________________________________________________________________
Added: branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html (0 => 223641)
--- branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html 2017-10-18 23:52:38 UTC (rev 223641)
@@ -0,0 +1,60 @@
+<script>
+
+if (window.testRunner)
+ window.testRunner.dumpAsText();
+
+window.addEventListener("load", function () {
+ let width = 5000;
+ let height = 5000;
+ let canvas = document.querySelector("canvas");
+ canvas.width = width;
+ canvas.height = height;
+ canvas.style.width = width + 'px';
+ canvas.style.height = height + 'px';
+ let gl = canvas.getContext("webgl");
+ let program = gl.createProgram();
+ let buffer = gl.createBuffer();
+ let vertices = new Float32Array([-1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1]);
+ let draw = function() {
+ gl.viewport(0, 0, width, height);
+ gl.drawArrays(gl.TRIANGLES, 0, 6);
+ };
+ let compileShader = function(kind, source) {
+ let shader = gl.createShader(kind);
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ gl.attachShader(program, shader);
+ };
+ compileShader(gl.VERTEX_SHADER, "attribute vec4 v; void main() { gl_Position = v; }");
+ compileShader(gl.FRAGMENT_SHADER, `precision mediump float;
+ void main() {
+ vec2 v = gl_FragCoord.xy;
+ v = fract(v*0.5);
+ gl_FragColor = vec4(v,0,1);
+ }`);
+ gl.linkProgram(program);
+ gl.useProgram(program);
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+ gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
+ gl.enableVertexAttribArray(0);
+ draw();
+
+ let original = document.getElementById("original");
+ original.textContent = `${gl.drawingBufferWidth} x ${gl.drawingBufferHeight}`;
+
+ width = 5001;
+ height = 5001;
+ canvas.width = width;
+ canvas.height = height;
+ canvas.style.width = width + 'px';
+ canvas.style.height = height + 'px';
+ draw();
+
+ let resized = document.getElementById("resized");
+ resized.textContent = `${gl.drawingBufferWidth} x ${gl.drawingBufferHeight}`;
+}, false);
+</script>
+<p>Original drawing buffer: <span id="original"></span></p>
+<p>Resized drawing buffer: <span id="resized"></span></p>
+<canvas></canvas>
Property changes on: branches/safari-604-branch/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html
___________________________________________________________________
Modified: branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations (223640 => 223641)
--- branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations 2017-10-18 23:41:44 UTC (rev 223640)
+++ branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations 2017-10-18 23:52:38 UTC (rev 223641)
@@ -3114,3 +3114,6 @@
webkit.org/b/177366 http/tests/security/frameNavigation/sandbox-ALLOWED-top-navigation-with-user-gesture-1.html [ Pass Timeout ]
webkit.org/b/177323 imported/w3c/web-platform-tests/fetch/security/embedded-credentials.tentative.sub.html [ Pass Failure ]
+
+# macOS only test
+fast/canvas/webgl/large-drawing-buffer-resize.html [ Skip ]
Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (223640 => 223641)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-10-18 23:41:44 UTC (rev 223640)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-10-18 23:52:38 UTC (rev 223641)
@@ -1,3 +1,22 @@
+2017-10-17 Dean Jackson <[email protected]>
+
+ Cherry-pick r223567. rdar://problem/35041476
+
+ 2017-10-16 Dean Jackson <[email protected]>
+
+ WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas
+ https://bugs.webkit.org/show_bug.cgi?id=178223
+ <rdar://problem/34597567>
+
+ Reviewed by Antoine Quint.
+
+ Remove the limit of 4k on the width/height of the renderbuffer.
+
+ Test: fast/canvas/webgl/large-drawing-buffer-resize.html
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::reshape):
+
2017-10-17 Jason Marcell <[email protected]>
Cherry-pick r223313. rdar://problem/35042269
Modified: branches/safari-604-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (223640 => 223641)
--- branches/safari-604-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2017-10-18 23:41:44 UTC (rev 223640)
+++ branches/safari-604-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2017-10-18 23:52:38 UTC (rev 223641)
@@ -847,9 +847,6 @@
// This is an approximation because at WebGLRenderingContext level we don't
// know if the underlying FBO uses textures or renderbuffers.
GC3Dint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize);
- // Limit drawing buffer size to 4k to avoid memory exhaustion.
- const int sizeUpperLimit = 4096;
- maxSize = std::min(maxSize, sizeUpperLimit);
GC3Dint maxWidth = std::min(maxSize, m_maxViewportDims[0]);
GC3Dint maxHeight = std::min(maxSize, m_maxViewportDims[1]);
width = clamp(width, 1, maxWidth);