Skip to content

Commit be06570

Browse files
authored
Add target-only WebGL backend
Add target-only WebGL/WebGL2 GLSL ES backend support.
1 parent 25eb856 commit be06570

16 files changed

Lines changed: 1063 additions & 60 deletions

.github/workflows/examples-test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ jobs:
127127
backend: "opengl",
128128
extension: ".glsl",
129129
}
130+
- {
131+
category: "graphics",
132+
example: "SimpleShader",
133+
backend: "webgl",
134+
extension: ".webgl.glsl",
135+
}
130136
- {
131137
category: "graphics",
132138
example: "SimpleShader",
@@ -183,6 +189,12 @@ jobs:
183189
backend: "opengl",
184190
extension: ".glsl",
185191
}
192+
- {
193+
category: "graphics",
194+
example: "PerlinNoise",
195+
backend: "webgl",
196+
extension: ".webgl.glsl",
197+
}
186198
- {
187199
category: "graphics",
188200
example: "PerlinNoise",

.github/workflows/translator-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
"rust",
3232
"CUDA",
3333
"hip",
34+
"webgl",
3435
"general",
3536
]
3637
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

crosstl/formatter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ def format_shader_code(code, backend, output_path=None):
334334
"opengl": ShaderLanguage.GLSL,
335335
"glsl": ShaderLanguage.GLSL,
336336
"ogl": ShaderLanguage.GLSL,
337+
"webgl": ShaderLanguage.GLSL,
338+
"webgl2": ShaderLanguage.GLSL,
339+
"essl": ShaderLanguage.GLSL,
340+
"glsl-es": ShaderLanguage.GLSL,
337341
"vulkan": ShaderLanguage.SPIRV,
338342
"spirv": ShaderLanguage.SPIRV,
339343
"spv": ShaderLanguage.SPIRV,

crosstl/translator/codegen/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
)
1919
from .rust_codegen import RustCodeGen
2020
from .SPIRV_codegen import VulkanSPIRVCodeGen
21+
from .webgl_codegen import WebGLCodeGen
2122

2223
register_backend(
2324
BackendSpec(
@@ -91,6 +92,16 @@
9192
format_backend="vulkan",
9293
)
9394
)
95+
register_backend(
96+
BackendSpec(
97+
name="webgl",
98+
codegen_class=WebGLCodeGen,
99+
aliases=("webgl2", "essl", "glsl-es"),
100+
file_extensions=(".webgl.glsl",),
101+
format_backend="opengl",
102+
has_source_frontend=False,
103+
)
104+
)
94105

95106
# Import slang_codegen only if available
96107
try:
@@ -120,6 +131,7 @@
120131
"MojoCodeGen",
121132
"RustCodeGen",
122133
"VulkanSPIRVCodeGen",
134+
"WebGLCodeGen",
123135
"get_backend",
124136
"get_codegen",
125137
"get_backend_extension",
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"""CrossGL-to-WebGL GLSL ES code generator."""
2+
3+
from .GLSL_codegen import GLSLCodeGen
4+
from .stage_utils import normalize_stage_name
5+
6+
7+
class WebGLCodeGen(GLSLCodeGen):
8+
"""Generate WebGL 2.0 compatible GLSL ES output from CrossGL ASTs."""
9+
10+
UNSUPPORTED_STAGE_NAMES = (
11+
{
12+
"compute",
13+
"geometry",
14+
"tessellation_control",
15+
"tessellation_evaluation",
16+
}
17+
| GLSLCodeGen.MESH_STAGE_NAMES
18+
| GLSLCodeGen.RAY_STAGE_NAMES
19+
)
20+
DEFAULT_PRECISION_LINES = (
21+
("float", "precision highp float;"),
22+
("int", "precision highp int;"),
23+
)
24+
25+
def default_glsl_version_line(self, ast, target_stage=None):
26+
return "#version 300 es"
27+
28+
def generate_program(self, ast, target_stage=None):
29+
self.validate_webgl_stage_support(ast, target_stage)
30+
code = super().generate_program(ast, target_stage=target_stage)
31+
return self._with_default_precision(code)
32+
33+
def validate_webgl_stage_support(self, ast, target_stage=None):
34+
stages = set()
35+
normalized_target_stage = normalize_stage_name(target_stage)
36+
if normalized_target_stage:
37+
stages.add(normalized_target_stage)
38+
39+
for func in getattr(ast, "functions", []) or []:
40+
qualifier = (
41+
func.qualifiers[0]
42+
if getattr(func, "qualifiers", None)
43+
else getattr(func, "qualifier", None)
44+
)
45+
stage_name = normalize_stage_name(qualifier)
46+
if stage_name:
47+
stages.add(stage_name)
48+
for stage_type in getattr(ast, "stages", {}) or {}:
49+
stage_name = normalize_stage_name(stage_type)
50+
if stage_name:
51+
stages.add(stage_name)
52+
53+
unsupported = sorted(stages & self.UNSUPPORTED_STAGE_NAMES)
54+
if unsupported:
55+
raise ValueError(
56+
"WebGL target does not support shader stage(s): "
57+
+ ", ".join(unsupported)
58+
)
59+
60+
def _with_default_precision(self, code):
61+
lines = code.splitlines()
62+
if not lines:
63+
return code
64+
65+
existing_precision = {
66+
"float": any(
67+
line.strip().startswith("precision ")
68+
and line.strip().endswith(" float;")
69+
for line in lines
70+
),
71+
"int": any(
72+
line.strip().startswith("precision ") and line.strip().endswith(" int;")
73+
for line in lines
74+
),
75+
}
76+
precision_lines = [
77+
line
78+
for scalar_kind, line in self.DEFAULT_PRECISION_LINES
79+
if not existing_precision[scalar_kind]
80+
]
81+
if not precision_lines:
82+
return code
83+
84+
insert_at = next(
85+
(
86+
index + 1
87+
for index, line in enumerate(lines)
88+
if line.startswith("#version")
89+
),
90+
0,
91+
)
92+
while insert_at < len(lines) and lines[insert_at].startswith("#extension"):
93+
insert_at += 1
94+
lines[insert_at:insert_at] = precision_lines
95+
return "\n".join(lines) + ("\n" if code.endswith("\n") else "")

docs/source/support-matrix.rst

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ implicitly supported.
2424

2525
"DirectX / HLSL", ".hlsl", "crosstl/translator/codegen/directx_codegen.py", "native", "crosstl/backend/DirectX", "tests/test_translator/test_codegen/test_directx_codegen.py, tests/test_backend/test_directx", "1071", "291", "Microsoft Learn HLSL reference; HLSL specification project"
2626
"OpenGL / GLSL", ".glsl", "crosstl/translator/codegen/GLSL_codegen.py", "native", "crosstl/backend/GLSL", "tests/test_translator/test_codegen/test_GLSL_codegen.py, tests/test_backend/test_GLSL", "1167", "177", "GLSL 4.60 specification; OpenGL registry"
27+
"WebGL / GLSL ES", ".webgl.glsl", "crosstl/translator/codegen/webgl_codegen.py", "target-only", "", "tests/test_translator/test_codegen/test_webgl_codegen.py", "7", "6", "WebGL 2.0 specification; OpenGL ES Shading Language 3.00 specification"
2728
"Metal", ".metal", "crosstl/translator/codegen/metal_codegen.py", "native", "crosstl/backend/Metal", "tests/test_translator/test_codegen/test_metal_codegen.py, tests/test_backend/test_metal", "962", "492", "Apple Metal resources; Metal Shading Language specification"
2829
"Vulkan SPIR-V", ".spvasm", "crosstl/translator/codegen/SPIRV_codegen.py", "native", "crosstl/backend/SPIRV", "tests/test_translator/test_codegen/test_SPIRV_codegen.py, tests/test_backend/test_SPIRV", "972", "36", "SPIR-V unified grammar; Khronos SPIR-V headers"
2930
"CUDA", ".cu", "crosstl/translator/codegen/cuda_codegen.py", "native", "crosstl/backend/CUDA", "tests/test_translator/test_codegen/test_CUDA_codegen.py, tests/test_backend/test_CUDA", "778", "194", "CUDA C++ programming guide"
@@ -37,6 +38,7 @@ implicitly supported.
3738

3839
"DirectX / HLSL", "42", "0", "1", "0", "0", "0"
3940
"OpenGL / GLSL", "42", "0", "1", "0", "0", "0"
41+
"WebGL / GLSL ES", "13", "0", "21", "9", "0", "0"
4042
"Metal", "41", "0", "2", "0", "0", "0"
4143
"Vulkan SPIR-V", "42", "0", "1", "0", "0", "0"
4244
"CUDA", "37", "0", "6", "0", "0", "0"
@@ -68,83 +70,83 @@ Feature Matrix
6870
Each category below uses the status codes from the legend.
6971

7072
.. csv-table:: target
71-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
73+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
7274

73-
"CrossGL to target code generation", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
75+
"CrossGL to target code generation", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
7476

7577
.. csv-table:: source
76-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
78+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
7779

78-
"Native source to CrossGL", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
79-
"Native lexer coverage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
80-
"Native preprocessor handling", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
80+
"Native source to CrossGL", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
81+
"Native lexer coverage", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
82+
"Native preprocessor handling", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
8183

8284
.. csv-table:: stages
83-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
85+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
8486

85-
"Vertex stage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
86-
"Fragment/pixel stage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
87-
"Compute stage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
88-
"Geometry stage", "Y", "Y", "D", "Y", "D", "D", "D", "D", "Y"
89-
"Tessellation stages", "Y", "D", "D", "Y", "D", "D", "D", "D", "Y"
90-
"Mesh/task/amplification stages", "Y", "Y", "Y", "Y", "D", "D", "D", "D", "D"
91-
"Ray tracing stages", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
87+
"Vertex stage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
88+
"Fragment/pixel stage", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
89+
"Compute stage", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
90+
"Geometry stage", "Y", "Y", "R", "D", "Y", "D", "D", "D", "D", "Y"
91+
"Tessellation stages", "Y", "D", "R", "D", "Y", "D", "D", "D", "D", "Y"
92+
"Mesh/task/amplification stages", "Y", "Y", "R", "Y", "Y", "D", "D", "D", "D", "D"
93+
"Ray tracing stages", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
9294

9395
.. csv-table:: stage I/O
94-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
96+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
9597

96-
"Stage parameter semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
97-
"Direct function return semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
98-
"Struct member semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
98+
"Stage parameter semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
99+
"Direct function return semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
100+
"Struct member semantics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
99101

100102
.. csv-table:: resources
101-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
103+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
102104

103-
"Explicit and automatic resource bindings", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
104-
"Constant/uniform buffers", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
105-
"Structured/storage buffers", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
106-
"Resource arrays", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
107-
"Texture and sampler object model", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
108-
"GLSL buffer block lowering", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
109-
"Resource memory qualifiers", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
105+
"Explicit and automatic resource bindings", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
106+
"Constant/uniform buffers", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
107+
"Structured/storage buffers", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
108+
"Resource arrays", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
109+
"Texture and sampler object model", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
110+
"GLSL buffer block lowering", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
111+
"Resource memory qualifiers", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
110112

111113
.. csv-table:: textures
112-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
113-
114-
"Texture sampling", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
115-
"Texture LOD, gradient, and offset operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
116-
"Projected texture operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
117-
"Texture gather operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
118-
"Shadow compare texture operations", "Y", "Y", "Y", "Y", "D", "D", "Y", "Y", "Y"
119-
"Texture query operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
120-
"Texel fetch operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
121-
"Multisample texture operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
122-
"Advanced texture operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
114+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
115+
116+
"Texture sampling", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
117+
"Texture LOD, gradient, and offset operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
118+
"Projected texture operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
119+
"Texture gather operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
120+
"Shadow compare texture operations", "Y", "Y", "D", "Y", "Y", "D", "D", "Y", "Y", "Y"
121+
"Texture query operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
122+
"Texel fetch operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
123+
"Multisample texture operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
124+
"Advanced texture operations", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
123125

124126
.. csv-table:: images
125-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
127+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
126128

127-
"Storage image load/store", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
128-
"Image atomics", "Y", "Y", "Y", "Y", "D", "D", "Y", "Y", "Y"
129-
"Multisample storage images", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
129+
"Storage image load/store", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
130+
"Image atomics", "Y", "Y", "D", "Y", "Y", "D", "D", "Y", "Y", "Y"
131+
"Multisample storage images", "D", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
130132

131133
.. csv-table:: language
132-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
133-
134-
"Struct declarations and construction", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
135-
"Array declarations and access", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
136-
"Function declarations and calls", "Y", "Y", "Y", "D", "D", "D", "D", "Y", "D"
137-
"Control flow", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
138-
"Synchronization and memory barriers", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
139-
"Wave/subgroup intrinsics", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
140-
"Match/pattern lowering", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
141-
"Vector and matrix expressions", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
142-
"Bitwise operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
134+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
135+
136+
"Struct declarations and construction", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
137+
"Array declarations and access", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
138+
"Function declarations and calls", "Y", "Y", "Y", "Y", "D", "D", "D", "D", "Y", "D"
139+
"Control flow", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
140+
"Synchronization and memory barriers", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
141+
"Wave/subgroup intrinsics", "Y", "Y", "R", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
142+
"Match/pattern lowering", "Y", "Y", "D", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
143+
"Vector and matrix expressions", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
144+
"Bitwise operations", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
143145

144146
.. csv-table:: validation
145-
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
147+
:header: "Feature", "DirectX / HLSL", "OpenGL / GLSL", "WebGL / GLSL ES", "Metal", "Vulkan SPIR-V", "CUDA", "HIP", "Mojo", "Rust", "Slang"
146148

147-
"Invalid shader shape validation", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
149+
"Invalid shader shape validation", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y"
148150

149151
Backlog
150152
-------
@@ -170,6 +172,8 @@ changes must be reviewed and committed in the source catalog.
170172
"DirectX / HLSL", "HLSL specification project", "https://microsoft.github.io/hlsl-specs/"
171173
"OpenGL / GLSL", "GLSL 4.60 specification", "https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/specs/gl/GLSLangSpec.4.60.html"
172174
"OpenGL / GLSL", "OpenGL registry", "https://github.com/KhronosGroup/OpenGL-Registry"
175+
"WebGL / GLSL ES", "WebGL 2.0 specification", "https://registry.khronos.org/webgl/specs/latest/2.0/"
176+
"WebGL / GLSL ES", "OpenGL ES Shading Language 3.00 specification", "https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf"
173177
"Metal", "Apple Metal resources", "https://developer.apple.com/metal/resources/"
174178
"Metal", "Metal Shading Language specification", "https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf"
175179
"Vulkan SPIR-V", "SPIR-V unified grammar", "https://raw.githubusercontent.com/KhronosGroup/SPIRV-Headers/main/include/spirv/unified1/spirv.core.grammar.json"

support/backends.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@
4747
}
4848
]
4949
},
50+
{
51+
"id": "webgl",
52+
"name": "WebGL / GLSL ES",
53+
"source_kind": "target-only",
54+
"aliases": ["webgl2", "essl", "glsl-es"],
55+
"target_extension": ".webgl.glsl",
56+
"translator_codegen": "crosstl/translator/codegen/webgl_codegen.py",
57+
"tests": ["tests/test_translator/test_codegen/test_webgl_codegen.py"],
58+
"docs": [
59+
{
60+
"name": "WebGL 2.0 specification",
61+
"url": "https://registry.khronos.org/webgl/specs/latest/2.0/"
62+
},
63+
{
64+
"name": "OpenGL ES Shading Language 3.00 specification",
65+
"url": "https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf"
66+
}
67+
]
68+
},
5069
{
5170
"id": "metal",
5271
"name": "Metal",

0 commit comments

Comments
 (0)