overflow_leak.vert.html (1629B)
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 </head> 17 <body> 18 <div id="description"></div> 19 <div id="console"></div> 20 <canvas id="example" width="2" height="2"> </canvas> 21 <script id="vshader" type="x-shader/x-vertex"> 22 // float literal overflow should not affect next literal parsing. 23 precision mediump float; 24 25 varying vec4 v_color; 26 attribute vec4 a_position; 27 void main() { 28 highp float floatOverflow = 1E100; 29 int i = 10; 30 if (i == 10) 31 v_color = vec4(0.0, 1.0, 0.0, 1.0); 32 else 33 v_color = vec4(1.0, 0.0, 0.0, 1.0); 34 gl_Position = a_position; 35 } 36 </script> 37 <script id="fshader" type="x-shader/x-fragment"> 38 precision mediump float; 39 40 varying vec4 v_color; 41 void main() { 42 gl_FragColor = v_color; 43 } 44 </script> 45 <script> 46 "use strict"; 47 description(); 48 var wtu = WebGLTestUtils; 49 var gl = wtu.create3DContext("example"); 50 wtu.setupUnitQuad(gl); 51 var program = wtu.setupProgram(gl, ["vshader", "fshader"]); 52 if (!program) 53 testFailed("Fail to setup program"); 54 wtu.clearAndDrawUnitQuad(gl); 55 wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green"); 56 57 var successfullyParsed = true; 58 </script> 59 <script src="../../../js/js-test-post.js"></script> 60 </body> 61 </html>