Skip to content

fix(naga): Don't panic on oversize types#9516

Open
andyleiserson wants to merge 1 commit intogfx-rs:trunkfrom
andyleiserson:jj-push-vyxw
Open

fix(naga): Don't panic on oversize types#9516
andyleiserson wants to merge 1 commit intogfx-rs:trunkfrom
andyleiserson:jj-push-vyxw

Conversation

@andyleiserson
Copy link
Copy Markdown
Contributor

Fixes #9440 a.k.a. https://bugzilla.mozilla.org/show_bug.cgi?id=2020561 and https://bugzilla.mozilla.org/show_bug.cgi?id=2031636.

Changes some panics on oversize types to be errors instead.

The messy thing here is that the Layouter operates lazily, so when we get an error from update(), it's not necessarily related to what we're working on at that moment. This is particularly problematic in the constant evaluator where the context for the error is assumed farther up the call stack, so I've made ConstantEvaluatorError::TypeTooLarge include the type, unlike the rest of the constant evaluator errors.

This could probably all be refactored to be cleaner, but this was as much time as I could justify spending on it right now. The type size limit is 2 GB; shaders that exceed it are pathological and unlikely to be useful in any current WebGPU deployment.

Testing
Adds directed tests in wgsl_errors.

Squash or Rebase? Squash

Checklist

  • I self-reviewed and fully understand this PR.
  • WebGPU implementations built with wgpu may be affected behaviorally.
  • Validation and feature gates are in place to confine behavioral changes.
  • Tests demonstrate the validation and altered logic works.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
    • I suppose we could changelog this? But seems pretty minor.
  • The PR is minimal, and doesn't make sense to land as multiple PRs.
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.

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.

Unhandled LayoutError::TooLarge in ConstantEvaluator::cast_array for extremely large WGSL arrays

1 participant