Skip to content

Conversation

ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented Oct 7, 2025

Found a spec. bug (see gpuweb/gpuweb#5341)! 😀 The WebGPU spec. didn't demand that we ensure that this was so, but it was intended to.

rebaseplz

Testing

TODO

Checklist

  • If this contains user-facing changes, add a CHANGELOG.md entry.

@ErichDonGubler
Copy link
Member Author

Current CI failures are unrelated, and are resolved with #8317.

@ErichDonGubler ErichDonGubler changed the title [naga] Reject fragment output locations > max_color_attachments Reject fragment output locations > max_color_attachments Oct 7, 2025
@ErichDonGubler ErichDonGubler added area: api Issues related to API surface area: correctness We're behaving incorrectly type: bug Something isn't working labels Oct 7, 2025
@ErichDonGubler ErichDonGubler changed the title Reject fragment output locations > max_color_attachments Reject fragment shader output locations > max_color_attachments Oct 7, 2025
@ErichDonGubler ErichDonGubler changed the title Reject fragment shader output locations > max_color_attachments Reject fragment shader output locations > max_color_attachments limit Oct 7, 2025
@ErichDonGubler ErichDonGubler force-pushed the erichdongubler-push-boinging-erudite-lemon branch from a8a62f6 to 5f9d9bc Compare October 7, 2025 19:33
@ErichDonGubler ErichDonGubler marked this pull request as ready for review October 7, 2025 19:45
Copy link
Contributor

@andyleiserson andyleiserson left a comment

Choose a reason for hiding this comment

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

We might also want to impose some limits in naga in cases where large values will result in allocating big arrays for the module or interface info.

let &Varying::Local { location, ref iv } = output else {
continue;
};
if location >= self.limits.max_color_attachments {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is true today that this will always be equal to hal::MAX_COLOR_ATTACHMENTS (used for the error message), but I don't know if we want to rely on that.

There's also a question whether it is an error for an output that is not consumed by the pipeline to be placed at a location above maxColorAttachments. The spec describes maxColorAttachments as a limit on the number of entries in various arrays appearing in descriptors.

| Self::NoEntryPointFound
| Self::MultipleEntryPointsFound => return ErrorType::Validation,
| Self::MultipleEntryPointsFound
| Self::ColorAttachmentLocationExceedsLimit { .. } => return ErrorType::Validation,
Copy link
Contributor

Choose a reason for hiding this comment

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

name bikeshedding: I would prefer ...TooLarge or ...OutOfBounds (strings that we already use in error variants) over ExceedsLimit. (Although I do see we have ExceededLimit... appearing in one place.)

I also might be inclined to make the name general enough to cover the case that the location lands on a gap between defined color targets (e.g. InvalidColorAttachmentLocation), although the primary responsibility for checking that seems to be later in create_render_pipeline (where it presently only generates a log::warn!), so maybe it's not important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface area: correctness We're behaving incorrectly type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants