shader-with-long-line.html (1954B)
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 GLSL Conformance Tests</title> 12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> 14 <script src="../../../js/js-test-pre.js"></script> 15 <script src="../../../js/webgl-test-utils.js"></script> 16 <script src="../../../js/glsl-conformance-test.js"></script> 17 </head> 18 <body> 19 <div id="description"></div> 20 <div id="console"></div> 21 <script id="fshaderWithLongLine" type="text/something-not-javascript"> 22 precision mediump float; 23 uniform float fooo; 24 #if defined(someSymbolNotDefined) 25 #error long 26 #endif 27 void main() 28 { 29 gl_FragColor = vec4(fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, 1.0); 30 } 31 </script> 32 <script> 33 "use strict"; 34 description("checks shader with long line succeeds"); 35 36 var wtu = WebGLTestUtils; 37 GLSLConformanceTester.runTests([ 38 { 39 fShaderId: 'fshaderWithLongLine', 40 fShaderSuccess: true, 41 fShaderPrep: function(str) { 42 function expand(str, re, replacement, count) { 43 for (var ii = 0; ii < count; ++ii) { 44 str = str.replace(re, replacement); 45 } 46 return str; 47 } 48 str = expand(str, new RegExp(" ", 'g'), " ", 12); 49 var manyZeros = expand("0", new RegExp("0", 'g'), "00", 8).substring(2); 50 str = expand(str, new RegExp("0", 'g'), manyZeros, 1); 51 str = expand(str, new RegExp("fooo", 'g'), "fooofooo", 6); 52 str = expand(str, new RegExp("long", 'g'), "longlong", 6); 53 //debug("len:" + str.length); 54 //debug(str); 55 return str; 56 }, 57 linkSuccess: true, 58 passMsg: 'shader that uses long lines should succeed', 59 } 60 ]); 61 62 debug(""); 63 var successfullyParsed = true; 64 65 </script> 66 </body> 67 </html>