shaders-with-missing-varyings.html (2174B)
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="vertexShader" type="text/something-not-javascript"> 22 // GLSL 1.0.17 4.3.5 23 void main() 24 { 25 gl_Position = vec4(0,0,0,0); 26 } 27 </script> 28 <script id="fragmentShader" type="text/something-not-javascript"> 29 // GLSL 1.0.17 4.3.5 30 precision mediump float; 31 32 varying $(type) v_varying; 33 34 void main() 35 { 36 gl_FragColor = $(code); 37 } 38 </script> 39 <script> 40 "use strict"; 41 var wtu = WebGLTestUtils; 42 var varyingTypes = [ 43 { type: "float", code: "vec4(v_varying, 0, 0, 0)", }, 44 { type: "vec2", code: "vec4(v_varying, 0, 0)", }, 45 { type: "vec3", code: "vec4(v_varying, 0)", }, 46 { type: "vec4", code: "vec4(v_varying)", }, 47 { type: "mat2", code: "vec4(v_varying[0][0], 0, 0, 0)", }, 48 { type: "mat3", code: "vec4(v_varying[0][0], 0, 0, 0)", }, 49 { type: "mat4", code: "vec4(v_varying[0][0], 0, 0, 0)", }, 50 ]; 51 var vSource = wtu.getScript("vertexShader"); 52 var fSource = wtu.getScript("fragmentShader"); 53 var tests = []; 54 for (var ii = 0; ii < varyingTypes.length; ++ii) { 55 var u1 = varyingTypes[ii]; 56 var vs = wtu.replaceParams(vSource, u1); 57 for (var jj = ii + 1; jj < varyingTypes.length; ++jj) { 58 var u2 = varyingTypes[jj]; 59 var fs = wtu.replaceParams(fSource, u2); 60 tests.push({ 61 vShaderSource: vs, 62 vShaderSuccess: true, 63 fShaderSource: fs, 64 fShaderSuccess: true, 65 linkSuccess: false, 66 passMsg: "vertex shader no varyings and fragment shader with varying " + u2.type + " should fail to link", 67 }); 68 } 69 } 70 GLSLConformanceTester.runTests(tests); 71 var successfullyParsed = true; 72 </script> 73 </body> 74 </html>