tor-browser

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

glsl-mat3-construction.html (1680B)


      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>GLSL mat3 construction test</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-generator.js"> </script>
     17 </head>
     18 <body>
     19 <div id="description"></div>
     20 <div id="console"></div>
     21 <script id="shader_emu" type="something-not-js">
     22 mat3 mat3_emu(vec3 v3_0, vec3 v3_1, vec3 v3_2) {
     23  mat3 test;
     24  test[0] = v3_0;
     25  test[1] = v3_1;
     26  test[2] = v3_2;
     27  return test;
     28 }
     29 </script>
     30 <script id="shader_test" type="something-not-js">
     31  vec3 v3 = vec3($(input).xyz);
     32  mat3 m3 = $(conversion)(v3, v3, v3);
     33  vec3 c;
     34  if ($(input).y < 0.33) {
     35    c = m3[0];
     36  } else if ($(input).y > 0.66) {
     37    c = m3[1];
     38  } else {
     39    c = m3[2];
     40  }
     41  $(output) = vec4(c, 1);
     42 </script>
     43 <script>
     44 "use strict";
     45 // See resources glsl-generator runBasicTest for how this works
     46 var wtu = WebGLTestUtils;
     47 GLSLGenerator.runBasicTest({
     48  gridRes: 8,
     49  tests: [
     50    {
     51      name: "vec3 to mat3",
     52      reference: {
     53        shader: wtu.getScript("shader_test"),
     54        subs: {
     55          emu: wtu.getScript("shader_emu"),
     56          conversion: "mat3_emu"
     57        }
     58      },
     59      test: {
     60        shader: wtu.getScript("shader_test"),
     61        subs: {
     62          conversion: "mat3"
     63        },
     64      }
     65    }
     66  ]
     67 });
     68 var successfullyParsed = true;
     69 </script>
     70 </body>
     71 </html>