Skip to content

Conversation

@vxpm
Copy link

@vxpm vxpm commented Jan 27, 2026

Description
validation for structs that contain a blend_src attribute in one of their members is wrong. the WebGPU spec says:

For each structure type S defined in a WGSL module (not just those used in shader stage inputs or outputs), let members be the set of members of S that have location attributes.

If any entry in members specifies a blend_src attribute, members must use dual source blending, which means:

  • members must contain exactly 2 entries, one with @location(0) @blend_src(0) and one with @location(0) @blend_src(1).
  • All the members must have same data type.

Otherwise, members must not contain two entries with the same location value.

(source)

the part where naga is wrong is this one:

let members be the set of members of S that have location attributes

currently, naga uses all the members of S during validation, instead of just the members with location attributes. this means you can't use any members with builtin attributes (such as frag_depth).

this PR fixes this by only checking members with location attributes.

related PR: #8856

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.

1 participant