tor-browser

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

sampler-no-precision.html (2467B)


      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 sampler with no precision qualifier 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 <script id="vshaderSamplerNoPrecision" type="x-shader/x-vertex">#version 300 es
     21 precision mediump float;
     22 
     23 uniform $(samplerType) u_sampler;
     24 
     25 void main() {
     26    gl_Position = vec4(0.0);
     27 }
     28 </script>
     29 <script id="fshaderSamplerNoPrecision" type="x-shader/x-fragment">#version 300 es
     30 precision mediump float;
     31 
     32 out vec4 my_FragColor;
     33 uniform $(samplerType) u_sampler;
     34 
     35 void main() {
     36    my_FragColor = vec4(0.0);
     37 }
     38 </script>
     39 <script type="application/javascript">
     40 "use strict";
     41 description("ESSL3 sampler with no precision qualifier should not compile.");
     42 
     43 var wtu = WebGLTestUtils;
     44 
     45 var fragmentShaderTemplate = wtu.getScript('fshaderSamplerNoPrecision');
     46 var vertexShaderTemplate = wtu.getScript('vshaderSamplerNoPrecision');
     47 
     48 // ESSL 3.00.4 section 4.5.4 types with no predefined precision.
     49 var samplerTypes = [
     50    'sampler3D',
     51    'samplerCubeShadow',
     52    'sampler2DShadow',
     53    'sampler2DArray',
     54    'sampler2DArrayShadow',
     55    'isampler2D',
     56    'isampler3D',
     57    'isamplerCube',
     58    'isampler2DArray',
     59    'usampler2D',
     60    'usampler3D',
     61    'usamplerCube',
     62    'usampler2DArray'
     63 ];
     64 
     65 var tests = [];
     66 
     67 for (var i = 0; i < samplerTypes.length; ++i) {
     68    var type = samplerTypes[i];
     69    var vertexShaderSrc = wtu.replaceParams(vertexShaderTemplate, {'samplerType': type});
     70    tests.push({
     71        vShaderSource: vertexShaderSrc,
     72        vShaderSuccess: false,
     73        linkSuccess: false,
     74        passMsg: 'Vertex shader with a ' + type + ' uniform with no precision qualifier should not compile'
     75    });
     76    var fragmentShaderSrc = wtu.replaceParams(fragmentShaderTemplate, {'samplerType': type});
     77    tests.push({
     78        fShaderSource: fragmentShaderSrc,
     79        fShaderSuccess: false,
     80        linkSuccess: false,
     81        passMsg: 'Fragment shader with a ' + type + ' uniform with no precision qualifier should not compile'
     82    });
     83 }
     84 
     85 GLSLConformanceTester.runTests(tests, 2);
     86 </script>
     87 </body>
     88 </html>