tor-browser

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

shaders-with-name-conflicts.html (2424B)


      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="fragmentShader" type="text/something-not-javascript">
     22 // fragment shader should succeed
     23 precision mediump float;
     24 uniform vec4 foo;
     25 void main()
     26 {
     27    gl_FragColor = foo;
     28 }
     29 </script>
     30 <script id="vertexShader" type="text/something-not-javascript">
     31 // vertex shader should succeed
     32 attribute vec4 foo;
     33 void main()
     34 {
     35    gl_Position = foo;
     36 }
     37 </script>
     38 <script>
     39 "use strict";
     40 
     41 /*
     42 This test previously concluded that an attribute in a vertex shader
     43 would conflict across shaders with a uniform of the same name in the
     44 fragment shader, based on the following sections of the GLSL ES 1.0.17
     45 specification:
     46 
     47 ---
     48 Section 4.2.6
     49 
     50 ...
     51 
     52 With the exception of uniform declarations, vertex and fragment shaders
     53 have separate name spaces.  Functions and global variables declared in a
     54 vertex shader cannot be referenced by a fragment shader and vice versa.
     55 Uniforms have a single name space.  Uniforms declared with the same name
     56 must have matching types and precisions.
     57 
     58 Section 4.3.3
     59 
     60 Attribute variables are required to have global scope
     61 
     62 Section 4.3.4
     63 
     64 The uniform qualifier is used to declare global variables
     65 ---
     66 
     67 GLSL ES 3.00 later confirmed that pipeline stages have distinct
     68 namespaces. The OpenGL ES working group confirmed in discussions
     69 https://github.com/KhronosGroup/WebGL/issues/3201 that this was the
     70 intended behavior for GLSL ES 1.00.
     71 
     72 For this reason, this test asserts that such usage does not generate a
     73 conflict.
     74 */
     75 
     76 GLSLConformanceTester.runTests([
     77    { vShaderId: 'vertexShader',
     78      vShaderSuccess: true,
     79      fShaderId: 'fragmentShader',
     80      fShaderSuccess: true,
     81      linkSuccess: true,
     82      passMsg: 'using the same name for a vertex shader attribute and fragment shader uniform should succeed'
     83    },
     84 ]);
     85 var successfullyParsed = true;
     86 </script>
     87 </body>
     88 </html>