Add a shader language — GLSL, HLSL or WGSL — next to CUDA and Metal
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 125
- Avg merge
- 5h 42m
- Merged PRs (30d)
- 136
Description
## What is missing
ripwire already reads CUDA, where kernel launch sites become call edges, and Metal. It does not read
GLSL, HLSL or WGSL. In a game engine, a renderer or a WebGPU app, the host code therefore appears to
call into nothing, and the CPU/GPU contract — bindings, uniform layouts, entry points — stays
invisible to an agent. The job is one shader language: measure the grammar candidates' parse rates
on real shader corpora, pick the best, extract functions, bindings and entry points, and disclose
the blind spots.
## The evidence
The grammar survey is already done and verified: **four tree-sitter grammars**, each recorded with
its license, pinned commit, ABI, external scanner and parent grammar. The measurement order is GLSL,
then HLSL, then WGSL. The corpora are named: glslang, DirectXShaderCompiler, Unity's Graphics
repository and wgpu.
The design decisions are framed rather than left open — a new `Lang` versus riding a C-family one
(with the CUDA and Metal precedents either way), entry points and stages, bindings and uniforms as
symbols, the include and import story (GLSL's include extensions, HLSL's `#include`, WGSL's lack of
any import, and naga_oil's `#import`), and built-in names that collide with user functions.
## Size
**Large** end to end, but the three languages are independent lanes and the first step is small:
- **The STEP 0 survey** (parse rates per grammar per corpus): small, and worth posting as a draft
pull request before starting extraction.
- **One language** with definitions, bindings and a red-first gate: medium to large.
- **Include and import edges:** a follow-up.
## Prerequisites
Shader experience — writing or reading GLSL, HLSL or WGSL and knowing how an engine binds resources
— plus C++23 and CMake, tree-sitter basics, and a shader corpus to measure on. The prompt names
public ones.
## Where to start
`prompts/help-wanted/shader-languages.md` follows `prompts/add-a-language.md` and carries the
verified grammar survey, the corpora, the design notes above, the traps and the acceptance criteria.
Like every prompt in `prompts/`, **it ends by writing a plan and stopping** — a maintainer agrees
the plan before any code is written.
Comment here to claim it, naming the language being taken.
Contributor guide
Research direction
Read prompts/help-wanted/shader-languages.md and its referenced prompts/add-a-language.md first. Measure the four surveyed grammar candidates against the named glslang, DirectXShaderCompiler, Unity Graphics, and wgpu corpora in the stated order. Done for the first step means posting the parse-rate results and a plan as a draft pull request, then stopping for maintainer agreement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100