tor-browser

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

vector-dynamic-indexing-swizzled-lvalue.html (1359B)


      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 swizzled vector l-value dynamic indexing 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 <script src="../../js/glsl-conformance-test.js"></script>
     16 </head>
     17 <body>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <!--
     21  The shader first assigns v.x to v.z (1.0)
     22  Then v.y to v.y (2.0)
     23  Then v.z to v.x (1.0)
     24 -->
     25 <script id="fshaderSwizzledLValueIndexing" type="x-shader/x-fragment">#version 300 es
     26 precision highp float;
     27 out vec4 my_FragColor;
     28 void main() {
     29    vec3 v = vec3(1.0, 2.0, 3.0);
     30    for (int i = 0; i < 3; i++) {
     31        v.zyx[i] = v[i];
     32    }
     33    my_FragColor = distance(v, vec3(1.0, 2.0, 1.0)) < 0.01 ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
     34 }
     35 </script>
     36 <script type="application/javascript">
     37 "use strict";
     38 description("Dynamic indexing of swizzled l-values should work.");
     39 
     40 GLSLConformanceTester.runRenderTests([
     41 {
     42  fShaderId: 'fshaderSwizzledLValueIndexing',
     43  fShaderSuccess: true,
     44  linkSuccess: true,
     45  passMsg: 'Index an l-value swizzled vector'
     46 },
     47 ], 2);
     48 </script>
     49 </body>
     50 </html>