tor-browser

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

gl-unknown-uniform.html (1721B)


      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 Unknown Uniform Conformance 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 </head>
     16 <body>
     17 <div id="description"></div>
     18 <div id="console"></div>
     19 <canvas id="canvas" width="2" height="2"> </canvas>
     20 <script id="vshader" type="x-shader/x-vertex">
     21 attribute vec4 vPosition;
     22 void main()
     23 {
     24    gl_Position = vPosition;
     25 }
     26 </script>
     27 
     28 <script id="fshader" type="x-shader/x-fragment">
     29 void main()
     30 {
     31    gl_FragColor = vec4(1.0,0.0,0.0,1.0);
     32 }
     33 </script>
     34 <script>
     35 "use strict";
     36 description("Tests that unknown uniforms don't cause errors.");
     37 
     38 debug("");
     39 debug("Canvas.getContext");
     40 
     41 var wtu = WebGLTestUtils;
     42 var gl = wtu.create3DContext("canvas");
     43 if (!gl) {
     44  testFailed("context does not exist");
     45 } else {
     46  testPassed("context exists");
     47 
     48  debug("");
     49 
     50  var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
     51  // Get the location of an unknown uniform.
     52  var loc = gl.getUniformLocation(program, "someUnknownUniform");
     53  assertMsg(loc === null, "location of unknown uniform should be null");
     54  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     55      "there should be no error from getting an unknown uniform");
     56  gl.uniform1f(loc, 1);
     57  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     58      "there should be no error from trying to set an unknown uniform");
     59 }
     60 
     61 debug("");
     62 var successfullyParsed = true;
     63 </script>
     64 <script src="../../js/js-test-post.js"></script>
     65 
     66 </body>
     67 </html>