tor-browser

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

sampler-array-indexing.html (2409B)


      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>ESSL300 sampler array indexing rules</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="vs" type="text/plain">#version 300 es
     22 void main() {}
     23 </script>
     24 <script id="fs_constant_integer_expression" type="text/plain">#version 300 es
     25 precision mediump float;
     26 uniform sampler2D u_tex[2];
     27 
     28 void main()
     29 {
     30  texture(u_tex[0], vec2(0));
     31  texture(u_tex[1], vec2(0));
     32 }
     33 </script>
     34 <script id="fs_constant_index_expression" type="text/plain">#version 300 es
     35 precision mediump float;
     36 uniform sampler2D u_tex[2];
     37 
     38 void main()
     39 {
     40  for (int i = 0; i < 2; i++) {
     41    texture(u_tex[i], vec2(0));
     42  }
     43 }
     44 </script>
     45 <script id="fs_constant_integer_expression_switch" type="text/plain">#version 300 es
     46 precision mediump float;
     47 uniform sampler2D u_tex[2];
     48 
     49 void main()
     50 {
     51  for (int i = 0; i < 2; i++) {
     52    switch (i) {
     53      case 0:
     54        texture(u_tex[0], vec2(0));
     55        break;
     56      case 1:
     57        texture(u_tex[1], vec2(0));
     58        break;
     59    }
     60  }
     61 }
     62 </script>
     63 <script type="application/javascript">
     64 "use strict";
     65 description();
     66 GLSLConformanceTester.runTests([
     67  {
     68    vShaderId: "vs",
     69    vShaderSuccess: true,
     70    fShaderId: "fs_constant_integer_expression",
     71    fShaderSuccess: true,
     72    linkSuccess: true,
     73    passMsg: "indexing into an array of samplers with constant-integer-expression is required",
     74  },
     75  {
     76    vShaderId: "vs",
     77    vShaderSuccess: true,
     78    fShaderId: "fs_constant_index_expression",
     79    fShaderSuccess: false,
     80    linkSuccess: false,
     81    passMsg: "indexing into an array of samplers with constant-index-expression is forbidden in essl300",
     82  },
     83  {
     84    vShaderId: "vs",
     85    vShaderSuccess: true,
     86    fShaderId: "fs_constant_integer_expression_switch",
     87    fShaderSuccess: true,
     88    linkSuccess: true,
     89    passMsg: "constant-index-expression can be converted into fs_constant_integer_expression via a switch",
     90  },
     91 ], 2);
     92 </script>
     93 </body>
     94 </html>