content/canvas/test/webgl-conformance/conformance/glsl/misc/shader-with-long-line.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5 -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10 <title>WebGL GLSL Conformance Tests</title>
    11 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
    12 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
    13 <script src="../../../resources/desktop-gl-constants.js" type="text/javascript"></script>
    14 <script src="../../../resources/js-test-pre.js"></script>
    15 <script src="../../resources/webgl-test-utils.js"></script>
    16 <script src="../../resources/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 description("checks shader with long line succeeds");
    35 var wtu = WebGLTestUtils;
    36 GLSLConformanceTester.runTests([
    37     { vShaderId: undefined,
    38       vShaderSuccess: true,
    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   ]);
    62 debug("");
    63 successfullyParsed = true;
    65 </script>
    66 </body>
    67 </html>

mercurial