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

Fix limits interface on web. #4107

Merged
merged 5 commits into from
Sep 1, 2023
Merged

Conversation

OptimisticPeach
Copy link
Contributor

@OptimisticPeach OptimisticPeach commented Sep 1, 2023

Checklist

  • Run cargo clippy.
  • Run cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes the limits request and reporting api for webgpu backend. Notice that since web_sys doesn't have an impl of requiredLimits for requesting limits, we tack on our own impl as needed (See rustwasm/wasm-bindgen#3587 for more details).

Description
Fills in the api for requesting device limits on the web, fills in the api for reporting device limits, and fixes the api for reporting adapter limits.

Testing
In a minimal wasm app, I run the following:

let adapter = {
    let instance = wgpu::Instance::default();
    instance
        .request_adapter(&wgpu::RequestAdapterOptions::default())
        .await
        .unwrap()
};
let limits = adapter.limits();
let (device, _queue) = adapter.request_device(
    &wgpu::DeviceDescriptor {
        label: None,
        features: Default::default(),
        limits: limits.clone(),
    },
    None,
)
    .await
    .unwrap();
let device_limits = device.limits();
assert_eq!(device_limits, limits);

And see no errors.

@OptimisticPeach OptimisticPeach marked this pull request as ready for review September 1, 2023 05:03
wgpu/src/backend/web.rs Outdated Show resolved Hide resolved
wgpu/src/backend/web.rs Outdated Show resolved Hide resolved
wgpu/src/backend/web.rs Outdated Show resolved Hide resolved
wgpu/src/backend/web.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.

One last comment, sorry :)

wgpu/src/backend/web.rs Outdated Show resolved Hide resolved
@cwfitzgerald cwfitzgerald enabled auto-merge (squash) September 1, 2023 05:35
@cwfitzgerald cwfitzgerald merged commit 41efabb into gfx-rs:trunk Sep 1, 2023
20 checks passed
@FL33TW00D FL33TW00D mentioned this pull request Sep 8, 2023
bradwerth pushed a commit to bradwerth/wgpu that referenced this pull request Sep 19, 2023
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