Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / rendering / rendering-stencil-large-viewport.html
blob1202106c1372a029f58f5660ca1bd8757418a763
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>WebGL Rendering Stencil large viewport Tests</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <script src="../../js/js-test-pre.js"></script>
14 <script src="../../js/webgl-test-utils.js"></script>
16 <script id="vs" type="x-shader/x-vertex">
17 attribute vec4 a_Position;
18 void main()
20 gl_Position = a_Position;
22 </script>
23 <script id="fs" type="x-shader/x-fragment">
24 precision mediump float;
25 uniform vec4 u_draw_color;
26 void main()
28 gl_FragColor = u_draw_color;
30 </script>
32 </head>
33 <body>
34 <canvas id="example" width="4" height="4"></canvas>
35 <div id="description"></div>
36 <div id="console"></div>
38 <script>
39 "use strict";
41 var wtu = WebGLTestUtils;
42 description("This test reproduces a driver bug on Intel windows platforms http://crbug.com/782317.");
44 var gl = wtu.create3DContext("example", {stencil: true});
46 var program, colorLoc;
48 // Rendering with large viewport and stencil buffer enabled will lead to
49 // memory leak and driver crash on d3d11 driver on Intel platforms.
50 function render_stencil() {
51 var canvas = document.getElementById("example");
52 gl.uniform4f(colorLoc, 1.0, 0.0, 0.0, 1.0);
54 canvas.width = 32767;
55 canvas.height = 32767;
56 gl.viewport(0, 0, 32767, 32767);
58 gl.enable(gl.STENCIL_TEST);
60 var kStencilRef = 4;
61 gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE);
62 gl.stencilFunc(gl.ALWAYS, kStencilRef, 0xFF);
64 gl.drawArrays(gl.TRIANGLES, 0, 6);
65 wtu.glErrorShouldBe(gl, gl.NO_ERROR);
66 wtu.checkCanvasRect(gl, 0, 0, 1, 1, [255, 0, 0, 255],
67 "stencil test should be red");
70 if (!gl) {
71 testFailed("WebGL context does not exist");
72 } else {
73 testPassed("WebGL context exists");
75 program = wtu.setupProgram(gl, ["vs", "fs"], ["a_Position"]);
76 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after program initialization");
77 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
79 colorLoc = gl.getUniformLocation(program, "u_draw_color")
80 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "query uniform location");
81 shouldBeNonNull('colorLoc');
82 wtu.setupUnitQuad(gl, 0);
84 render_stencil();
87 var successfullyParsed = true;
88 </script>
89 <script src="../../js/js-test-post.js"></script>
91 </body>
92 </html>