Skip to content

naga/src/diagnostic_filter.rs is in language-independent code, but defines WGSL syntax #6485

@jimblandy

Description

@jimblandy

I'm concerned that src/diagnostic_filter.rs is where we define the WGSL names of FilterableTriggeringRules. Specifically, FilterableTriggeringRule's from_ident and to_ident rules are WGSL-specific.

Ideally, Naga IR is a language-independent representation of a shader module. Certainly its semantics are tailored for the languages we want to represent, but the specific spelling of Naga IR features should be localized to front and back ends. This principle isn't followed perfectly by existing code, but it's what we're aiming for.

It seems right to put FilterableTriggeringRule in language-independent code, like src/diagnostic_filter.rs. But the from_ident and to_ident methods probably belong somewhere in src/front/wgsl, and should be named from_wgsl and to_wgsl.

Moving that code to the WGSL front end would also make the #[cfg(feature = "wgsl-in")] conditional on tracking_issue_num unnecessary.

When we get to the point of propagating diagnostic filters into WGSL output, then we may have reached the point of needing a home for WGSL information used by both the front and back ends. #6443 also wants such a home, for holding the WGSL spellings of Naga IR's builtin functions.

cc @ErichDonGubler

Metadata

Metadata

Labels

lang: WGSLWebGPU Shading LanguagenagaShader Translator

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions