Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / attribs / gl-bindAttribLocation-repeated.html
blobcfbea4fb6366c32aa063dfe7b4c2159b7d77851c
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 Repeated BindAttribLocation Test</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 </head>
16 <body>
17 <canvas id="example" width="50" height="50">
18 </canvas>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="vshader" type="x-shader/x-vertex">
22 attribute vec4 vPosition;
23 void main()
25 gl_Position = vPosition;
27 </script>
29 <script id="fshader" type="x-shader/x-fragment">
30 void main()
32 gl_FragColor = vec4(0.0,1.0,0.0,1.0);
34 </script>
36 <script>
37 "use strict";
38 description("Test repeated loading of programs involving bindAttribLocation calls");
39 debug("Regression test for <a href='https://code.google.com/p/chromium/issues/detail?id=510637'>crbug.com/510637</a>");
40 var wtu = WebGLTestUtils;
41 var gl = wtu.create3DContext("example");
42 var g_program;
43 var g_attribLocation;
44 function setup(attribIndex) {
45 var program = wtu.setupProgram(
46 gl, ['vshader', 'fshader'], ['vPosition'], [attribIndex]);
47 g_program = program;
48 g_attribLocation = attribIndex;
49 shouldBe("gl.getAttribLocation(g_program, 'vPosition')", "g_attribLocation");
50 return program;
53 var p0 = setup(0);
54 var p3 = setup(3);
55 var p1 = setup(1);
56 // This call fails the getAttribLocation check on some drivers when
57 // Chrome's program binary cache is enabled. On the affected drivers,
58 // it returns the bound attribute location from the first binary
59 // created. Swapping 0 and 1 above will cause it to return 1 rather
60 // than 0.
61 p3 = setup(3);
63 var successfullyParsed = true;
64 </script>
65 <script src="../../js/js-test-post.js"></script>
67 </body>
68 </html>