tor-browser

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

const-struct-from-array-as-function-parameter.html (1381B)


      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 passing struct from a const array into a function parameter bug</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 <script id="fShaderTest" type="x-shader/x-fragment">#version 300 es
     21 
     22 precision highp float;
     23 struct S { float member; };
     24 
     25 const S s[2] = S[]( S(1.), S(2.));
     26 
     27 bool useStruct( S s) { return s.member > 0.0; }
     28 
     29 out vec4 outColor;
     30 
     31 void main( void )
     32 {
     33    outColor = vec4(0.0, 0.0, 0.0, 1.0);
     34    for (int i = 0; i < 2; ++i) {
     35        if (useStruct(s[i])) {
     36            outColor.g++;
     37        }
     38    }
     39 }
     40 </script>
     41 <script type="application/javascript">
     42 "use strict";
     43 description();
     44 
     45 // Covers bug:
     46 // http://crbug.com/871434
     47 
     48 GLSLConformanceTester.runTests([
     49 {
     50  fShaderId: 'fShaderTest',
     51  fShaderSuccess: true,
     52  linkSuccess: true,
     53  passMsg: 'Passing a struct from a dynamically indexed const array into a non-const function parameter should work.',
     54  render: true
     55 }
     56 ], 2);
     57 </script>
     58 </body>
     59 </html>