I'm skeptical that it was the language designers' intention to allow duplicate global diagnostic filters, although I can see why the standard supports that interpretation.
In naga::diagnostic_filter, we have ShouldConflictOnFullDuplicate, whose comments say:
/// Determines whether [`DiagnosticFilterMap::add`] should consider full duplicates a conflict.
///
/// In WGSL, directive position does not consider this case a conflict, while attribute position
/// does.
§11.6. diagnostic does forbid duplicates, but specifically refers to "diagnostic attributes", not global directives.
Maybe I'm just not seeing the rationale, or I haven't found the discussion, but it seems weird to me that duplicates would be tolerated in one place but forbidden in the other. Because of the way the spec is structured, I think there's some chance this was just an oversight.
And my coder's heart deeply and fiercely resents being required to add an enum like ShouldConflictOnFullDuplicate if there isn't some justification for it. That kind of vermin will take over if you let it.
Its definitely intentional (and has CTS coverage), but even a non-normative rationale isn't in the spec. It's unclear why this is desirable. I'm interested to see what upstream says.
I'm skeptical that it was the language designers' intention to allow duplicate global diagnostic filters, although I can see why the standard supports that interpretation.
In
naga::diagnostic_filter
, we haveShouldConflictOnFullDuplicate
, whose comments say:In the WGSL spec, I can see that:
§4.2. Global Diagnostic Filter does not mention anything about forbidding duplicates.
§11.6. diagnostic does forbid duplicates, but specifically refers to "diagnostic attributes", not global directives.
Maybe I'm just not seeing the rationale, or I haven't found the discussion, but it seems weird to me that duplicates would be tolerated in one place but forbidden in the other. Because of the way the spec is structured, I think there's some chance this was just an oversight.
And my coder's heart deeply and fiercely resents being required to add an enum like
ShouldConflictOnFullDuplicate
if there isn't some justification for it. That kind of vermin will take over if you let it.CC @ErichDonGubler