invalid-invariant.html (2199B)
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>Negative tests for the use of the invariant qualifier and pragma</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="vertexShaderInvariant" type="text/something-not-javascript">#version 300 es 22 precision mediump float; 23 invariant out vec4 v_varying; 24 25 void main() 26 { 27 v_varying = vec4(0.0, 0.0, 0.0, 1.0); 28 gl_Position = v_varying; 29 } 30 </script> 31 <script id="fragmentShaderVariant" type="text/something-not-javascript">#version 300 es 32 precision mediump float; 33 34 in vec4 v_varying; 35 out vec4 my_color; 36 37 void main() 38 { 39 my_color = v_varying; 40 } 41 </script> 42 <script id="fragmentShaderInputInvariant" type="text/something-not-javascript">#version 300 es 43 precision mediump float; 44 45 invariant in vec4 v_varying; 46 out vec4 my_color; 47 48 void main() 49 { 50 my_color = v_varying; 51 } 52 </script> 53 <script id="fragmentShaderGlobalInvariant" type="text/something-not-javascript">#version 300 es 54 #pragma STDGL invariant(all) 55 precision mediump float; 56 57 in vec4 v_varying; 58 out vec4 my_color; 59 60 void main() 61 { 62 my_color = v_varying; 63 } 64 </script> 65 <script type="application/javascript"> 66 "use strict"; 67 description(); 68 GLSLConformanceTester.runTests([ 69 { 70 vShaderId: "vertexShaderInvariant", 71 vShaderSuccess: true, 72 fShaderId: "fragmentShaderGlobalInvariant", 73 fShaderSuccess: false, 74 linkSuccess: false, 75 passMsg: "fragment shader with global invariant pragma must fail", 76 }, 77 { 78 vShaderId: "vertexShaderInvariant", 79 vShaderSuccess: true, 80 fShaderId: "fragmentShaderInputInvariant", 81 fShaderSuccess: false, 82 linkSuccess: false, 83 passMsg: "fragment shader with an input variable which is invariant must fail", 84 }, 85 ], 2); 86 </script> 87 </body> 88 </html>