docs: add EXTENSIONS.md describing the WgslExtension feature - #126
Open
schell wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
WgslExtensiontrait 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents the existing
WgslExtensiontrait and the#[wgsl(extensions = [...])]macro attribute at the repo root in a newEXTENSIONS.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.rsand the DEVLOG entries from 2026-05-15and 2026-05-29.
What it covers
WgslExtensiontrait (single required method,modify_ir)extensions = [...]macro attribute syntaxrender) with the generated code shown
ir::Module: item kinds, the preserved Rust attributesystem (
ir::Attribute, not rendered into WGSL)SlabItemExtderive-driven codegen,and appending a const
wgsl-rs-layoutcrate as a real-world consumernon-rendering, scope visibility, rejection of non-
WgslExtensiontypes, etc.)
anchors
Verification
cargo fmt --checkpassesextension.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>.