comments.html (5131B)
1 <!-- 2 Copyright (c) 2020 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>Comments</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> 21 "use strict"; 22 description(); 23 24 // Your syntax highlighter may hate this file. 25 // Because this stuff is tricky, we collect all tests here, including duplicating from other tests. 26 // That way, this test file is a one-stop-shop for validation testing. 27 28 const nonAscii = [ 29 65533, 30 65533, 31 65533, 32 65533, 33 834, 34 96, 35 65533, 36 114, 37 65533, 38 98, 39 65533, 40 104, 41 65533, 42 104, 43 65533, 44 322, 45 834, 46 514, 47 65533, 48 65533, 49 322, 50 65533, 51 65533, 52 66, 53 ].map(x => String.fromCodePoint(x)).join(''); 54 55 GLSLConformanceTester.runTests([{ 56 vShaderSource: `void main() {}`, 57 vShaderSuccess: true, 58 linkSuccess: true, 59 passMsg: 'Normal minimal testcase' 60 }, { 61 vShaderSource: `void main() {}/*`, 62 vShaderSuccess: false, 63 linkSuccess: false, 64 passMsg: 'Missing block-comment-end' 65 }, { 66 vShaderSource: `void main() {}/**`, 67 vShaderSuccess: false, 68 linkSuccess: false, 69 passMsg: 'Partial block-comment-end' 70 }, { 71 vShaderSource: `void main() {}/**/`, 72 vShaderSuccess: true, 73 linkSuccess: true, 74 passMsg: 'Complete block-comment-end' 75 }, { 76 vShaderSource: `void main() {}/* **/`, 77 vShaderSuccess: true, 78 linkSuccess: true, 79 passMsg: 'Complete block-comment-end with **/' 80 }, { 81 vShaderSource: `void main() {}/`, 82 vShaderSuccess: false, 83 linkSuccess: false, 84 passMsg: 'Partial line-comment-begin at EOF' 85 }, { 86 vShaderSource: `void main() {}//`, 87 vShaderSuccess: true, 88 linkSuccess: true, 89 passMsg: 'Complete line-comment-begin at EOF' 90 }, { 91 vShaderSource: `// 92 void main() {}`, 93 vShaderSuccess: true, 94 linkSuccess: true, 95 passMsg: `Minimal line comment: "//,\\n"` 96 }, { 97 vShaderSource: `//\ 98 99 void main() {}`, 100 vShaderSuccess: true, 101 linkSuccess: true, 102 passMsg: `Minimal continued line comment: "//,\\,\\n,\\n"` 103 }, { 104 vShaderSource: `//\ 105 a 106 void main() {}`, 107 vShaderSuccess: true, 108 linkSuccess: true, 109 passMsg: `Line-comment continuation with content that must be skipped: "//,\\,\\n,a,\\n"` 110 }, { 111 vShaderSource: `void main() {} // The quick brown fox jumped\\over the lazy dog`, 112 vShaderSuccess: true, 113 linkSuccess: true, 114 passMsg: 'Backslash in comment' 115 }, { 116 vShaderSource: `void main() {} // The quick brown fox jumped\\over the lazy dog 117 `, 118 vShaderSuccess: true, 119 linkSuccess: true, 120 passMsg: 'Backslash in comment with newline before EOF' 121 }, { 122 vShaderSource: `void main() {} // The quick brown fox jumped\\ 123 over the lazy dog`, 124 vShaderSuccess: true, 125 linkSuccess: true, 126 passMsg: 'Line-comment with backslash-line-continuation' 127 }, { 128 vShaderSource: `void main() {} // The quick brown fox jumped\\ 129 over the lazy dog 130 `, 131 vShaderSuccess: true, 132 linkSuccess: true, 133 passMsg: 'Line-comment with backslash-line-continuation with newline before EOF' 134 }, { 135 vShaderSource: `void main() {}//${String.fromCodePoint(0x8f)}`, 136 vShaderSuccess: true, 137 linkSuccess: true, 138 passMsg: 'upper-ascii in line-comment' 139 }, { 140 vShaderSource: `void main() {}/*${String.fromCodePoint(0x8f)}*/`, 141 vShaderSuccess: true, 142 linkSuccess: true, 143 passMsg: 'upper-ascii in block-comment' 144 145 // - 146 // Like comment_frag.frag from conformance/ogles/GL/build/build_049_to_056.html 147 }, { 148 vShaderSource: ` 149 void main() 150 { 151 /****** // comment not closed 152 }`, 153 vShaderSuccess: false, 154 linkSuccess: false, 155 passMsg: 'Unclosed block-comment containing line-comment' 156 157 158 // - 159 // Like conformance/glsl/misc/non-ascii-comments.vert.html 160 }, { 161 vShaderSource: `void main() {}/*${String.fromCodePoint(0x8f)}`, 162 vShaderSuccess: false, 163 linkSuccess: false, 164 passMsg: 'upper-ascii in unterminated block-comment' 165 }, { 166 vShaderSource: `void main() {}// ${nonAscii}`, 167 vShaderSuccess: true, 168 linkSuccess: true, 169 passMsg: 'More non-ascii in line-comment' 170 }, { 171 vShaderSource: `void main() {}/* 172 * ${nonAscii} 173 */`, 174 vShaderSuccess: true, 175 linkSuccess: true, 176 passMsg: 'More non-ascii in block-comment' 177 }, { 178 vShaderSource: `void main() {}/* 179 * ${nonAscii} 180 *`, 181 vShaderSuccess: false, 182 linkSuccess: false, 183 passMsg: 'More non-ascii in unterminated block-comment' 184 185 186 // - 187 // Like deqp/data/gles2/shaders/preprocessor.html | preprocessor.comments.comment_trick_2_* 188 }, { 189 vShaderSource: `void main() { 190 float out0; 191 /**/ 192 out0 = 1.0; 193 /*/ 194 out0 = 0.0; 195 /**/ 196 }`, 197 vShaderSuccess: true, 198 linkSuccess: true, 199 passMsg: '/**/ /*/ /**/' 200 }]); 201 </script> 202 </body> 203 </html>