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.
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>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
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.
53 ].map(x
=> String
.fromCodePoint(x
)).join('');
55 GLSLConformanceTester
.runTests([{
56 vShaderSource
: `void main() {}`,
59 passMsg
: 'Normal minimal testcase'
61 vShaderSource
: `void main() {}/*`,
62 vShaderSuccess
: false,
64 passMsg
: 'Missing block-comment-end'
66 vShaderSource
: `void main() {}/**`,
67 vShaderSuccess
: false,
69 passMsg
: 'Partial block-comment-end'
71 vShaderSource
: `void main() {}/**/`,
74 passMsg
: 'Complete block-comment-end'
76 vShaderSource
: `void main() {}/* **/`,
79 passMsg
: 'Complete block-comment-end with **/'
81 vShaderSource
: `void main() {}/`,
82 vShaderSuccess
: false,
84 passMsg
: 'Partial line-comment-begin at EOF'
86 vShaderSource
: `void main() {}//`,
89 passMsg
: 'Complete line-comment-begin at EOF'
95 passMsg
: `Minimal line comment: "//,\\n"`
100 vShaderSuccess
: true,
102 passMsg
: `Minimal continued line comment: "//,\\,\\n,\\n"`
107 vShaderSuccess
: true,
109 passMsg
: `Line-comment continuation with content that must be skipped: "//,\\,\\n,a,\\n"`
111 vShaderSource
: `void main() {} // The quick brown fox jumped\\over the lazy dog`,
112 vShaderSuccess
: true,
114 passMsg
: 'Backslash in comment'
116 vShaderSource
: `void main() {} // The quick brown fox jumped\\over the lazy dog
118 vShaderSuccess
: true,
120 passMsg
: 'Backslash in comment with newline before EOF'
122 vShaderSource
: `void main() {} // The quick brown fox jumped\\
124 vShaderSuccess
: true,
126 passMsg
: 'Line-comment with backslash-line-continuation'
128 vShaderSource
: `void main() {} // The quick brown fox jumped\\
131 vShaderSuccess
: true,
133 passMsg
: 'Line-comment with backslash-line-continuation with newline before EOF'
135 vShaderSource
: `void main() {}//${String.fromCodePoint(0x8f)}`,
136 vShaderSuccess
: true,
138 passMsg
: 'upper-ascii in line-comment'
140 vShaderSource
: `void main() {}/*${String.fromCodePoint(0x8f)}*/`,
141 vShaderSuccess
: true,
143 passMsg
: 'upper-ascii in block-comment'
146 // Like comment_frag.frag from conformance/ogles/GL/build/build_049_to_056.html
151 /****** // comment not closed
153 vShaderSuccess
: false,
155 passMsg
: 'Unclosed block-comment containing line-comment'
159 // Like conformance/glsl/misc/non-ascii-comments.vert.html
161 vShaderSource
: `void main() {}/*${String.fromCodePoint(0x8f)}`,
162 vShaderSuccess
: false,
164 passMsg
: 'upper-ascii in unterminated block-comment'
166 vShaderSource
: `void main() {}// ${nonAscii}`,
167 vShaderSuccess
: true,
169 passMsg
: 'More non-ascii in line-comment'
171 vShaderSource
: `void main() {}/*
174 vShaderSuccess
: true,
176 passMsg
: 'More non-ascii in block-comment'
178 vShaderSource
: `void main() {}/*
181 vShaderSuccess
: false,
183 passMsg
: 'More non-ascii in unterminated block-comment'
187 // Like deqp/data/gles2/shaders/preprocessor.html | preprocessor.comments.comment_trick_2_*
189 vShaderSource
: `void main() {
197 vShaderSuccess
: true,
199 passMsg
: '/**/ /*/ /**/'