Unreviewed, rolling out r223459.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2017 18:49:11 +0000 (18:49 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Oct 2017 18:49:11 +0000 (18:49 +0000)
This change introduced LayoutTest failures.

Reverted changeset:

"WebGL clamps drawingBufferWidth to 4096 pixels on a 5120
monitor/canvas"
https://bugs.webkit.org/show_bug.cgi?id=178223
https://trac.webkit.org/changeset/223459

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223563 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt [deleted file]
LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

index f333b35..d50ab25 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-17  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r223459.
+
+        This change introduced LayoutTest failures.
+
+        Reverted changeset:
+
+        "WebGL clamps drawingBufferWidth to 4096 pixels on a 5120
+        monitor/canvas"
+        https://bugs.webkit.org/show_bug.cgi?id=178223
+        https://trac.webkit.org/changeset/223459
+
 2017-10-17  Youenn Fablet  <youenn@apple.com>
 
         Add preliminary support for fetch event
diff --git a/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt b/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize-expected.txt
deleted file mode 100644 (file)
index a67347e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Original drawing buffer: 5000 x 5000
-
-Resized drawing buffer: 5001 x 5001
-
-
diff --git a/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html b/LayoutTests/fast/canvas/webgl/large-drawing-buffer-resize.html
deleted file mode 100644 (file)
index 779b408..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<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>
index 1320f1d..c8363d4 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-17  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r223459.
+
+        This change introduced LayoutTest failures.
+
+        Reverted changeset:
+
+        "WebGL clamps drawingBufferWidth to 4096 pixels on a 5120
+        monitor/canvas"
+        https://bugs.webkit.org/show_bug.cgi?id=178223
+        https://trac.webkit.org/changeset/223459
+
 2017-10-17  Youenn Fablet  <youenn@apple.com>
 
         Add preliminary support for fetch event
index f85ad12..c1d0449 100644 (file)
@@ -846,6 +846,9 @@ void WebGLRenderingContextBase::reshape(int width, int height)
     // 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);