tor-browser

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

shader-precision-format-obeyed.html (2370B)


      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>WebGL GLSL Conformance Tests</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="fshaderWithHighPrecision" type="text/something-not-javascript">
     22 precision highp float;
     23 uniform vec4 constantColor;
     24 
     25 void main()
     26 {
     27    gl_FragColor = constantColor;
     28 }
     29 </script>
     30 <script id="fshaderWhichCompilesWithHighp" type="text/something-not-javascript">
     31 #ifdef GL_FRAGMENT_PRECISION_HIGH
     32 // Something which compiles
     33 #else
     34 somethingWhichDoesNotCompile();
     35 #endif
     36 
     37 void main()
     38 {
     39    gl_FragColor = vec4(0, 0, 0, 1);
     40 }
     41 </script>
     42 <script id="fshaderWhichCompilesWithoutHighp" type="text/something-not-javascript">
     43 #ifndef GL_FRAGMENT_PRECISION_HIGH
     44 // Something which compiles
     45 #else
     46 somethingWhichDoesNotCompile();
     47 #endif
     48 
     49 void main()
     50 {
     51    gl_FragColor = vec4(0, 0, 0, 1);
     52 }
     53 </script>
     54 <script>
     55 "use strict";
     56 description("Checks that getShaderPrecisionFormat's return value matches whether highp is supported in fragment shaders.");
     57 
     58 var wtu = WebGLTestUtils;
     59 var gl = wtu.create3DContext();
     60 var precision = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
     61 var highpSupported = (precision.rangeMin >= 62 && precision.rangeMax >= 62 && precision.precision >= 16);
     62 debug("highp is" + (highpSupported ? "" : " not") + " supported in fragment shaders");
     63 
     64 GLSLConformanceTester.runTests([
     65 {
     66  fShaderId: 'fshaderWithHighPrecision',
     67  fShaderSuccess: highpSupported,
     68  linkSuccess: highpSupported,
     69  passMsg: "getShaderPrecisionFormat's results agree with highp support in fragment shaders",
     70 },
     71 {
     72  fShaderId: highpSupported ? 'fshaderWhichCompilesWithHighp' : 'fshaderWhichCompilesWithoutHighp',
     73  fShaderSuccess: true,
     74  linkSuccess: true,
     75  passMsg: "getShaderPrecisionFormat's results agree with definition of GL_FRAGMENT_PRECISION_HIGH",
     76 },
     77 ]);
     78 
     79 debug("");
     80 var successfullyParsed = true;
     81 </script>
     82 </body>
     83 </html>