Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the device's queue via a weak ref instead of an ID #5230

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

nical
Copy link
Contributor

@nical nical commented Feb 9, 2024

Connections

Description

This is one of the internal uses of IDs instead of Arc/Weak references.

With this PR the Queue has an strong reference to the device and the device has a weak ref to the queue.
I think that to align with the WebGPU spec we should do the opposite (The device owns the queue). However that's more complicated to do this way because of the way the device and queue are destroyed currently (not impossible but more complicated).

This does not quite fix the test from #5211, but it turns the panic into a validation error in create_command_encoder.

Checklist

  • Run cargo fmt.
  • Run cargo clippy.
  • Run cargo xtask test to run tests.

wgpu-core/src/device/resource.rs Outdated Show resolved Hide resolved
wgpu-core/src/device/resource.rs Outdated Show resolved Hide resolved
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Very nice

@cwfitzgerald cwfitzgerald merged commit 286306d into gfx-rs:trunk Feb 15, 2024
27 checks passed
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.

2 participants