Bug 1945965 – remove new tab April Fools logo. r=home-newtab-reviewers,reemhamz
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / bugs / undefined-index-should-not-crash.html
blob0c97c987f8842b4dfc7ec12d60063d2f648e3ef5
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>Bug - indexing with 'int()' should not crash</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>
15 <script src="../../../js/glsl-conformance-test.js"></script>
16 </head>
17 <body>
18 <canvas id="example" width="40" height="40"> </canvas>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="vshader" type="x-shader/x-vertex">
22 void main(){
23 gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
25 </script>
26 <script id="fshaderTest" type="x-shader/x-fragment">
27 precision mediump float;
28 uniform vec4 uniformVec;
29 uniform mat4 uniformMat;
30 uniform float uniformArray[4];
31 void main()
33 vec4 tempVec = vec4(0.0);
34 mat4 tempMat = mat4(0.0);
35 float tempArray[4];
36 gl_FragColor = vec4($(indexed)[int()]);
38 </script>
39 <script>
40 "use strict";
41 var wtu = WebGLTestUtils;
43 var fTestSource = wtu.getScript("fshaderTest");
45 var tests = [];
47 var indexedValues = ['tempVec', 'tempMat[0]', 'tempArray', 'uniformVec', 'uniformMat[0]', 'uniformArray'];
49 for (var i = 0; i < indexedValues.length; ++i) {
50 var subs = {indexed: indexedValues[i]};
51 tests.push({
52 vShaderId: "vshader",
53 vShaderSuccess: true,
54 fShaderSource: wtu.replaceParams(fTestSource, subs),
55 fShaderSuccess: false,
56 linkSuccess: false,
57 passMsg: "shader with invalid index expression int() should not compile",
58 });
60 GLSLConformanceTester.runTests(tests);
61 </script>
62 </body>
63 </html>