gl-bindAttribLocation-repeated.html (1918B)
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 --> 6 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() 24 { 25 gl_Position = vPosition; 26 } 27 </script> 28 29 <script id="fshader" type="x-shader/x-fragment"> 30 void main() 31 { 32 gl_FragColor = vec4(0.0,1.0,0.0,1.0); 33 } 34 </script> 35 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; 51 } 52 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); 62 63 var successfullyParsed = true; 64 </script> 65 <script src="../../js/js-test-post.js"></script> 66 67 </body> 68 </html>