boolean_precision.html (2148B)
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="vertexTest" type="text/something-not-javascript"> 22 // parsing boolean variables with precision should fail 23 void main() { 24 mediump $(type) fail = $(initializer); 25 gl_Position = vec4(0.0, 0.0, 0.0, 1.0); 26 } 27 </script> 28 <script id="fragmentTest" type="text/something-not-javascript"> 29 // parsing boolean variables with precision should fail 30 void main() { 31 mediump $(type) fail = $(initializer); 32 gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); 33 } 34 </script> 35 <script> 36 "use strict"; 37 var wtu = WebGLTestUtils; 38 39 var types = ['bool', 'bvec2', 'bvec3', 'bvec4']; 40 var tests = []; 41 var vTestSource = wtu.getScript("vertexTest"); 42 var fTestSource = wtu.getScript("fragmentTest"); 43 44 for (var i = 0; i < types.length; ++i) { 45 var initializer = 'true'; 46 if (types[i] !== 'bool') { 47 initializer = types[i] + "(true"; 48 for (var j = 0; j < i; ++j) { 49 initializer += ", true"; 50 } 51 initializer += ")"; 52 } 53 var subs = {type: types[i], initializer: initializer}; 54 tests.push({ 55 vShaderSource: wtu.replaceParams(vTestSource, subs), 56 vShaderSuccess: false, 57 passMsg: "vertex shader with a " + types[i] + " variable with precision should fail." 58 }); 59 tests.push({ 60 fShaderSource: wtu.replaceParams(fTestSource, subs), 61 fShaderSuccess: false, 62 passMsg: "fragment shader with a " + types[i] + " variable with precision should fail." 63 }); 64 } 65 GLSLConformanceTester.runTests(tests); 66 67 var successfullyParsed = true; 68 </script> 69 </body> 70 </html>