Skip to content

Commit 60365f6

Browse files
authored
Allow double-underscore e.g. foo__bar in shader identifiers. (#3761)
Test currently fails on at least Firefox. Fixes #3649.
1 parent 9f97276 commit 60365f6

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

sdk/tests/conformance/glsl/misc/00_test_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ shader-with-default-precision.vert.html
4141
shader-with-dfdx-no-ext.frag.html
4242
shader-with-dfdx.frag.html
4343
--min-version 1.0.2 shader-with-do-loop.html
44+
--min-version 1.0.4 shader-with-double-underscore.html
4445
shader-with-error-directive.html
4546
shader-with-explicit-int-cast.vert.html
4647
shader-with-float-return-value.frag.html
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!--
2+
Copyright (c) 2026 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+
// vertex shader that uses double-underscore in identifier should succeed
23+
attribute vec4 foo__bar;
24+
void main()
25+
{
26+
gl_Position = foo__bar;
27+
}
28+
</script>
29+
<script id="fragmentShader" type="text/something-not-javascript">
30+
// fragment shader that uses double-underscore in identifier should succeed
31+
attribute vec4 foo__bar;
32+
void main()
33+
{
34+
gl_FragColor = foo__bar;
35+
}
36+
</script>
37+
<script>
38+
"use strict";
39+
GLSLConformanceTester.runTest();
40+
var successfullyParsed = true;
41+
</script>
42+
</body>
43+
</html>

specs/latest/1.0/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4668,6 +4668,16 @@ <h3><a name="CURRENT_PROGRAM_INVALIDATED">Current program invalidated upon unsuc
46684668
</p>
46694669
</div>
46704670

4671+
4672+
<h3><a name="DOUBLE_UNDERSCORE_IN_SHADER_IDENTIFIERS">Double-Underscore in Shader Identifiers</a></h3>
4673+
<p>
4674+
Identifiers in shaders may contain double-underscores, for example as in <code>"g__Foo"</code>.
4675+
</p>
4676+
<div class="note rationale">
4677+
To ensure robust portablility, implementations shall support this even if the underlying driver does not support this. (via e.g. mangling)
4678+
</div>
4679+
4680+
46714681
<!-- ======================================================================================================= -->
46724682

46734683
<h2>References</h2>

0 commit comments

Comments
 (0)