Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ Bottom level categories:

- Raise the minimum version of the `wasm-bindgen` family to the earliest releases that support wasm64. By @nickbabcock in [#9836](https://github.com/gfx-rs/wgpu/pull/9836).

#### WebGPU

- Upgrade vendored WebGPU bindings and `wasm-bindgen` to 0.2.127. By @beicause in [#10034](https://github.com/gfx-rs/wgpu/pull/10034).
Comment thread
beicause marked this conversation as resolved.

#### GLES

- Update `glow` to 0.18 for wasm64 support. By @nickbabcock in [#9836](https://github.com/gfx-rs/wgpu/pull/9836).
Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ windows = { version = "0.62", default-features = false }
# wasm dependencies
console_error_panic_hook = "0.1.5"
console_log = "1"
js-sys = { version = "0.3.100", default-features = false }
wasm-bindgen = { version = "0.2.123", default-features = false }
wasm-bindgen-futures = { version = "0.4.73", default-features = false }
web-sys = { version = "0.3.100", default-features = false }
js-sys = { version = "0.3.104", default-features = false }
wasm-bindgen = { version = "0.2.127", default-features = false }
wasm-bindgen-futures = { version = "0.4.77", default-features = false }
web-sys = { version = "0.3.104", default-features = false }
web-time = "1.1.0"

# deno dependencies
Expand Down
6 changes: 3 additions & 3 deletions examples/standalone/03_hdr_surface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ block2 = "0.6.2"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.5"
wasm-bindgen = "0.2.123"
wasm-bindgen-futures = "0.4.73"
web-sys = { version = "0.3.100", features = [
wasm-bindgen = "0.2.127"
wasm-bindgen-futures = "0.4.77"
web-sys = { version = "0.3.104", features = [
"console",
"Document",
"Element",
Expand Down
46 changes: 18 additions & 28 deletions wgpu/src/backend/webgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ fn map_js_sys_limits(limits: &wgt::Limits) -> js_sys::Object<js_sys::Number> {
}

fn future_request_adapter(
result: Result<js_sys::JsOption<webgpu_sys::GpuAdapter>, wasm_bindgen::JsValue>,
result: Result<js_sys::JsNullable<webgpu_sys::GpuAdapter>, wasm_bindgen::JsValue>,
requested_backends: Backends,
) -> Result<dispatch::DispatchAdapter, wgt::RequestAdapterError> {
result
Expand Down Expand Up @@ -1073,19 +1073,9 @@ fn future_request_device(
}

fn future_pop_error_scope(
result: Result<js_sys::JsOption<webgpu_sys::GpuError>, wasm_bindgen::JsValue>,
result: Result<js_sys::JsNullable<webgpu_sys::GpuError>, wasm_bindgen::JsValue>,
) -> Option<crate::Error> {
let js_option = result.ok()?;
// WebGPU's `popErrorScope()` resolves with `null` when the scope captured no error, but
// `wasm-bindgen`'s `JsOption` only treats `undefined` as absent (not `null`), so `null`
// must be checked explicitly here.
if js_option.is_empty() || JsValue::is_null(&js_option) {
return None;
}
let err = js_option
.into_option()
.expect("null/undefined checked above");
Some(crate::Error::from_js(err.into()))
Some(crate::Error::from_js(result.ok()?.into_option()?.into()))
}

fn future_compilation_info(
Expand Down Expand Up @@ -2293,10 +2283,10 @@ impl dispatch::DeviceInterface for WebDevice {
.bind_group_layouts
.iter()
.map(|bgl| match bgl {
Some(bgl) => js_sys::JsOption::wrap(bgl.inner.as_webgpu().inner.clone()),
None => js_sys::JsOption::new(),
Some(bgl) => js_sys::JsNullable::wrap(bgl.inner.as_webgpu().inner.clone()),
None => js_sys::JsNullable::new(),
})
.collect::<Vec<js_sys::JsOption<webgpu_sys::GpuBindGroupLayout>>>();
.collect::<Vec<js_sys::JsNullable<webgpu_sys::GpuBindGroupLayout>>>();
let mapped_desc = webgpu_sys::GpuPipelineLayoutDescriptor::new(&temp_layouts);
if let Some(label) = desc.label {
mapped_desc.set_label(label);
Expand Down Expand Up @@ -2348,11 +2338,11 @@ impl dispatch::DeviceInterface for WebDevice {
&mapped_attributes,
);
mapped_vbuf.set_step_mode(map_vertex_step_mode(vbuf.step_mode));
js_sys::JsOption::wrap(mapped_vbuf)
js_sys::JsNullable::wrap(mapped_vbuf)
}
None => js_sys::JsOption::new(),
None => js_sys::JsNullable::new(),
})
.collect::<Vec<js_sys::JsOption<webgpu_sys::GpuVertexBufferLayout>>>();
.collect::<Vec<js_sys::JsNullable<webgpu_sys::GpuVertexBufferLayout>>>();

mapped_vertex_state.set_buffers(&buffers);

Expand Down Expand Up @@ -2391,11 +2381,11 @@ impl dispatch::DeviceInterface for WebDevice {
mapped_color_state.set_blend(&mapped_blend_state);
}
mapped_color_state.set_write_mask(target.write_mask.bits());
js_sys::JsOption::wrap(mapped_color_state)
js_sys::JsNullable::wrap(mapped_color_state)
}
None => js_sys::JsOption::new(),
None => js_sys::JsNullable::new(),
})
.collect::<Vec<js_sys::JsOption<webgpu_sys::GpuColorTargetState>>>();
.collect::<Vec<js_sys::JsNullable<webgpu_sys::GpuColorTargetState>>>();
let module = frag.module.inner.as_webgpu();
let mapped_fragment_desc = webgpu_sys::GpuFragmentState::new(&module.module, &targets);
insert_constants_map(&mapped_fragment_desc, frag.compilation_options.constants);
Expand Down Expand Up @@ -2612,14 +2602,14 @@ impl dispatch::DeviceInterface for WebDevice {
.color_formats
.iter()
.map(|cf| match cf {
Some(cf) => js_sys::JsOption::wrap(
Some(cf) => js_sys::JsNullable::wrap(
wasm_bindgen::JsValue::from(map_texture_format(*cf))
.dyn_into::<js_sys::JsString>()
.unwrap(),
),
None => js_sys::JsOption::new(),
None => js_sys::JsNullable::new(),
})
.collect::<Vec<js_sys::JsOption<js_sys::JsString>>>();
.collect::<Vec<js_sys::JsNullable<js_sys::JsString>>>();
let mapped_desc = webgpu_sys::GpuRenderBundleEncoderDescriptor::new(&mapped_color_formats);
if let Some(label) = desc.label {
mapped_desc.set_label(label);
Expand Down Expand Up @@ -3288,11 +3278,11 @@ impl dispatch::CommandEncoderInterface for WebCommandEncoder {
}
mapped_color_attachment.set_store_op(map_store_op(ca.ops.store));

js_sys::JsOption::wrap(mapped_color_attachment)
js_sys::JsNullable::wrap(mapped_color_attachment)
}
None => js_sys::JsOption::new(),
None => js_sys::JsNullable::new(),
})
.collect::<Vec<js_sys::JsOption<webgpu_sys::GpuRenderPassColorAttachment>>>();
.collect::<Vec<js_sys::JsNullable<webgpu_sys::GpuRenderPassColorAttachment>>>();

let mapped_desc = webgpu_sys::GpuRenderPassDescriptor::new(&mapped_color_attachments);

Expand Down
16 changes: 8 additions & 8 deletions wgpu/src/backend/webgpu/webgpu_sys/gen_Gpu.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions wgpu/src/backend/webgpu/webgpu_sys/gen_GpuAdapter.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading