global-invariant-does-not-leak-across-shaders.html (1925B)
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>Global invariant does not leak across shaders</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="InvariantVertex" type="x-shader/x-vertex"> 21 #pragma STDGL invariant(all) 22 23 void main() 24 { 25 gl_Position = vec4(1.0, 0.0, 0.0, 1.0); 26 } 27 </script> 28 <script id="Fragment" type="x-shader/x-fragment"> 29 precision mediump float; 30 31 void main() 32 { 33 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); 34 } 35 </script> 36 <script id="VertexWithVarying" type="x-shader/x-vertex"> 37 varying vec2 testVarying; 38 39 void main() { 40 gl_Position = vec4(1.0, 0.0, 0.0, 1.0); 41 testVarying = vec2(0.0, 0.0); 42 } 43 </script> 44 <script id="FragmentWithVarying" type="x-shader/x-fragment"> 45 precision mediump float; 46 varying vec2 testVarying; 47 48 void main() 49 { 50 gl_FragColor = vec4(testVarying, 0.0, 1.0); 51 } 52 </script> 53 <script type="text/javascript"> 54 "use strict"; 55 description("The use of the global invariant pragma in one shader must not affect other shaders."); 56 57 GLSLConformanceTester.runTests([ 58 { 59 vShaderId: "InvariantVertex", 60 vShaderSuccess: true, 61 fShaderId: "Fragment", 62 fShaderSuccess: true, 63 linkSuccess: true, 64 passMsg: "Shaders using global invariant pragma should compile and link." 65 }, 66 { 67 vShaderId: "VertexWithVarying", 68 vShaderSuccess: true, 69 fShaderId: "FragmentWithVarying", 70 fShaderSuccess: true, 71 linkSuccess: true, 72 passMsg: "Shaders not using global invariant pragma should compile and link." 73 }, 74 ]); 75 </script> 76 </body> 77 </html>