Skip to content

Add a shader language — GLSL, HLSL or WGSL — next to CUDA and Metal #160

Description

@joyful-ii-V-I

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions