tor-browser

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

struct-specifiers-in-uniforms.html (2227B)


      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 <!DOCTYPE html>
      7 <html>
      8 <head>
      9 <meta charset="utf-8">
     10 <link rel="stylesheet" href="../../../resources/js-test-style.css" />
     11 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css" />
     12 <script src="../../../js/js-test-pre.js"></script>
     13 <script src="../../../js/webgl-test-utils.js"></script>
     14 <script src="../../../js/glsl-conformance-test.js"></script>
     15 <title></title>
     16 </head>
     17 <body>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <script id="fragmentShader" type="text/something-not-javascript">
     21 precision mediump float;
     22 uniform struct S { $(type) field;} s;
     23 void main() {
     24    // All uniforms are required to be zero initialized. Add the color green
     25    // to make the rendering test pass.
     26    gl_FragColor = $(asVec4) + vec4(0.0, 1.0, 0.0, 1.0);
     27 }
     28 </script>
     29 <script>
     30 "use strict";
     31 description("Verifies that structure specifiers work with uniforms.");
     32 var tests = [];
     33 var wtu = WebGLTestUtils;
     34 var typeInfos = [
     35    { type: 'float',    asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
     36    { type: 'vec2',     asVec4: 'vec4(s.field,0.0,0.0)' },
     37    { type: 'vec3',     asVec4: 'vec4(s.field,0.0)' },
     38    { type: 'vec4',     asVec4: 's.field' },
     39    { type: 'int',      asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
     40    { type: 'ivec2',    asVec4: 'vec4(s.field,0.0,0.0)' },
     41    { type: 'ivec3',    asVec4: 'vec4(s.field,0.0)' },
     42    { type: 'ivec4',    asVec4: 'vec4(s.field)' },
     43    { type: 'bool',     asVec4: 'vec4(0.0,s.field,0.0,0.0)' },
     44    { type: 'bvec2',    asVec4: 'vec4(s.field,0.0,0.0)' },
     45    { type: 'bvec3',    asVec4: 'vec4(s.field,0.0)' },
     46    { type: 'bvec4',    asVec4: 'vec4(s.field)' },
     47 ];
     48 typeInfos.forEach(function (typeInfo) {
     49    var replaceParams = {
     50        type: typeInfo.type,
     51        asVec4: typeInfo.asVec4
     52    };
     53    tests.push({
     54        fShaderSource: wtu.replaceParams(wtu.getScript('fragmentShader'), replaceParams),
     55        passMsg: typeInfo.type,
     56        fShaderSuccess: true,
     57        linkSuccess: true,
     58        render:true
     59    });
     60 });
     61 GLSLConformanceTester.runTests(tests);
     62 var successfullyParsed = true;
     63 </script>
     64 </body>
     65 </html>