tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

glsl-construct-vec-mat-index.html (1550B)


      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="fragmentShader" type="text/something-not-javascript">
     22 // A matrix constructor with two writes and reads to the same variable inside it in different parameters must succeed "mat2(index++, vec4(index++))"
     23 // ESSL 1.00 spec section 5.4 Constructors: "Arguments are evaluated from left to right."
     24 precision mediump float;
     25 bool equal(mat2 m1, mat2 m2)
     26 {
     27    float EPSILON = 0.00001;
     28    for (int i = 0; i < 2; i++) {
     29        for (int j = 0; j < 2; j++) {
     30            if (abs(m1[i][j] - m2[i][j]) > EPSILON)
     31                return false;
     32        }
     33    }
     34    return true;
     35 }
     36 void main()
     37 {
     38    int i = 0;
     39    mat2 m = mat2(i++, vec4(i++));
     40    if (equal(m, mat2(0, 1, 1, 1)))
     41        gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
     42    else
     43        gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
     44 }
     45 </script>
     46 
     47 <script>
     48 "use strict";
     49 GLSLConformanceTester.runRenderTest();
     50 var successfullyParsed = true;
     51 </script>
     52 </body>
     53 </html>