Skip to content

Convert as_hal calls to use guards intead of callbacks #7863

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

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

cwfitzgerald
Copy link
Member

Description

This converts all as_hal calls (except CommandBuffers) from callbacks to guards. This will make the api signifigantly better.

I needed to add a few escape hatches in the locking infrastructure to allow dependent locks to exist in a single guard. All of the unsafe in this PR does not affect Mozilla.

Review experience is commit by commit

Testing

No current testing of the as_hal api at all. Working on it.

Squash or Rebase?

Rebase

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@cwfitzgerald cwfitzgerald requested a review from a team as a code owner June 29, 2025 05:23
@cwfitzgerald cwfitzgerald changed the title [core] Move as_hal methods to their own file Convert as_hal calls to use guards intead of callbacks Jun 29, 2025
@cwfitzgerald cwfitzgerald force-pushed the cw/as_hal_guards branch 2 times, most recently from e57540a to f58ac37 Compare June 29, 2025 05:28
@Vecvec Vecvec requested a review from a team June 29, 2025 05:47
@Vecvec
Copy link
Collaborator

Vecvec commented Jun 29, 2025

I'm not the one doing the review, I just noticed a typo.

@JMS55
Copy link
Collaborator

JMS55 commented Jun 29, 2025

Do you still have to unwrap() manually in case of backend API mismatch?

@cwfitzgerald
Copy link
Member Author

Do you still have to unwrap() manually in case of backend API mismatch?

Yes all apis return options.

@JMS55
Copy link
Collaborator

JMS55 commented Jun 29, 2025

I'd rather it unwrap in wgpu, personally. I can't imagine why you would want it to be optional.

Users are likely going to perform a backend check higher-up, and switch between e.g. dlss_vk and dlss_dx.

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.

3 participants