Skip to content

Move ErrorScopes implementation into wgpu-core - #10086

Merged
teoxoy merged 7 commits into
gfx-rs:trunkfrom
sagudev:error
Aug 19, 2026
Merged

Move ErrorScopes implementation into wgpu-core#10086
teoxoy merged 7 commits into
gfx-rs:trunkfrom
sagudev:error

Conversation

@sagudev

@sagudev sagudev commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Connections
Towards #8911

Description
As outlined in #8911 (comment) in this PR we only move implementation of error scopes into wgpu-core. Errors are currently still produced by consumers (wgpu, deno, ...) and pushed onto device via handle_error and co. The error design is taken from wgpu, but handling somewhat different (wgpu has special handling for panicking situations and uses indexes to check for out-of-order drops so for the time being wgpu still has own implementation of push and pop but now using the stack from wgc). For wgpu we now use ParentDevice::device from wgc and send error in there.

I managed to get deno changes to minimum, but the most complication is using events from wgc for device lost and uncaptured device error as we need Send/Sync for types we bring in closures. So we use ArcMutex https://docs.rs/deno_inside/latest/deno_inside/struct.V8CrossThreadTaskSpawner.html and pass other non-send/sync stuff via hashmap via state.

Testing
Should be covered by existing tests.

Squash or Rebase?

Rebase.

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.
  • 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.

@sagudev
sagudev requested a review from teoxoy August 16, 2026 11:54
@teoxoy teoxoy self-assigned this Aug 17, 2026
Comment thread deno_webgpu/error.rs Outdated
Comment thread wgpu/src/backend/wgpu_core.rs Outdated
Comment thread wgpu/src/backend/wgpu_core.rs Outdated
Comment thread wgpu/src/backend/wgpu_core.rs
Comment thread wgpu/src/backend/wgpu_core.rs Outdated
Comment thread deno_webgpu/adapter.rs Outdated
Comment thread deno_webgpu/adapter.rs Outdated
@ErichDonGubler ErichDonGubler added area: api Issues related to API surface kind: refactor Making existing function faster or nicer labels Aug 17, 2026
@sagudev
sagudev force-pushed the error branch 4 times, most recently from 55826ae to 7cece35 Compare August 18, 2026 07:34
@teoxoy

teoxoy commented Aug 18, 2026

Copy link
Copy Markdown
Member

@sagudev could you fixup the 2 commits? I can also merge as is if there are conflicts since they do already compile individually.

@sagudev

sagudev commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

@sagudev could you fixup the 2 commits? I can also merge as is if there are conflicts since they do already compile individually.

I am not sure what you are asking me to do. All commits should be good to go (they pass CI independently) and github does not report any conflicts to me. Should I rebase?

@teoxoy

teoxoy commented Aug 19, 2026

Copy link
Copy Markdown
Member

There are 2 commits named "Move error types to wgpu-types", I thought you wanted to squash the 2nd into the first but there might be conflicts. Also "use cross thread spawn and store the data in state" could be squashed into "[deno] Use error impl from core".

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Ideally we would implement ParentDevice but it needs Labeled which is nontrivial

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev

sagudev commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

I did rebase and cleaned up commits.

@teoxoy

teoxoy commented Aug 19, 2026

Copy link
Copy Markdown
Member

Thanks!

@sagudev

sagudev commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Anything else blocking landing this?

@teoxoy

teoxoy commented Aug 19, 2026

Copy link
Copy Markdown
Member

Oh, no - I was waiting on that job that kept intermittently failing to succeed.

@teoxoy
teoxoy merged commit 9625c42 into gfx-rs:trunk Aug 19, 2026
95 of 96 checks passed
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 kind: refactor Making existing function faster or nicer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants