Skip to content

docs: add EXTENSIONS.md describing the WgslExtension feature - #126

Open
schell wants to merge 1 commit into
mainfrom
docs/extensions
Open

docs: add EXTENSIONS.md describing the WgslExtension feature#126
schell wants to merge 1 commit into
mainfrom
docs/extensions

Conversation

@schell

@schell schell commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Documents the existing WgslExtension trait and the
#[wgsl(extensions = [...])] macro attribute at the repo root in a new
EXTENSIONS.md.

This is pure documentation; no source or test changes are included. The
trait and macro attribute are already implemented and stable — the file
consolidates what was previously only available via the rustdoc on
crates/wgsl-rs/src/extension.rs and the DEVLOG entries from 2026-05-15
and 2026-05-29.

What it covers

  • The WgslExtension trait (single required method, modify_ir)
  • The extensions = [...] macro attribute syntax
  • The 4-step pipeline (build IR → extensions → type substitution →
    render) with the generated code shown
  • Working with ir::Module: item kinds, the preserved Rust attribute
    system (ir::Attribute, not rendered into WGSL)
  • Three worked examples: no-op, SlabItemExt derive-driven codegen,
    and appending a const
  • Why extensions exist and the two design decisions they encode
  • The wgsl-rs-layout crate as a real-world consumer
  • Constraints and pitfalls (run order, substitution timing, attribute
    non-rendering, scope visibility, rejection of non-WgslExtension
    types, etc.)
  • Cross-references to source files, trybuild tests, and DEVLOG
    anchors

Verification

  • cargo fmt --check passes
  • All internal source/test links resolve against the current tree
  • All cited line numbers (extension.rs:51-58,
    macros/src/lib.rs:105-113,479-495, ir/types.rs:9-24,
    DEVLOG 2026-05-15 / 2026-05-29 anchors) verified against the actual
    files

AI disclosure

Per AGENTS.md, this commit was generated with AI
assistance. The author is disclosed as Schell Carl Scivally with minimax-m3 <efsubenovex@gmail.com>.

Copilot AI review requested due to automatic review settings July 16, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new root-level document (EXTENSIONS.md) that consolidates how downstream crates can extend wgsl-rs by implementing WgslExtension and wiring extensions into #[wgsl(extensions = [...])], including pipeline ordering, IR details, and worked examples.

Changes:

  • Documented the WgslExtension trait contract and where it lives in the codebase.
  • Documented the extensions = [...] macro attribute syntax and execution ordering.
  • Added guidance/examples for inspecting/modifying ir::Module, including preserved Rust attributes and common pitfalls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread EXTENSIONS.md Outdated
Comment thread EXTENSIONS.md Outdated
Comment thread EXTENSIONS.md Outdated
Documents the existing WgslExtension trait and the
`#[wgsl(extensions = [...])]` macro attribute: the trait itself,
the per-module run order, working with ir::Module items and preserved
Rust attributes, three worked examples (no-op, derive-driven SlabItem
codegen, appending a const), the design rationale from DEVLOG
2026-05-15 and 2026-05-29, and the wgsl-rs-layout crate as a
real-world consumer.
@schell
schell force-pushed the docs/extensions branch from 8dabe53 to 8a8414c Compare July 28, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants