mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Update wasm32 dependencies, set alpha_mode
on web target (#3040)
This commit is contained in:
parent
65e405193e
commit
ffd733726a
@ -140,6 +140,11 @@ SurfaceConfiguration {
|
||||
- Document that `write_buffer_with()` is sound but unwise to read from by @kpreid in [#3006](https://github.com/gfx-rs/wgpu/pull/3006)
|
||||
- Explain why `Adapter::as_hal` and `Device::as_hal` have to take callback functions. By @jimblandy in [#2992](https://github.com/gfx-rs/wgpu/pull/2992)
|
||||
|
||||
### Dependency Updates
|
||||
|
||||
#### WebGPU
|
||||
- Update wasm32 dependencies, set `alpha_mode` on web target by @jinleili in [#3040](https://github.com/gfx-rs/wgpu/pull/3040)
|
||||
|
||||
### Build Configuration
|
||||
|
||||
- Add the `"strict_asserts"` feature, to enable additional internal
|
||||
|
58
Cargo.lock
generated
58
Cargo.lock
generated
@ -961,9 +961,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@ -1949,9 +1949,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@ -1959,13 +1959,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -1974,9 +1974,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-cli-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4016fbd42224de21aab2f009aeaec61067d278a298ba7f8f7f8d40fbffea0822"
|
||||
checksum = "03f35e0387a2c787ca5ee299bfb4259352b2a2184b406f8ee9f978c3c4671645"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.9.3",
|
||||
@ -1998,9 +1998,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-externref-xform"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f33c8e2d3f3b6f6647f982911eb4cb44998c8cca97a4fe7afc99f616ebb33a73"
|
||||
checksum = "0d010a32a516a793adbea5835eab6f736d11c0cdd10ebe0c762c420f67510244"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
@ -2008,9 +2008,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.31"
|
||||
version = "0.4.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
|
||||
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@ -2020,9 +2020,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@ -2030,9 +2030,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2043,9 +2043,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-multi-value-xform"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7015b54357604811162710d5cf274ab85d974fe1e324222dd5b2133afdefe9b9"
|
||||
checksum = "78b8c8d5dcc451b7e6a9c98d8fd966ff768a1e8f8afb270a829780086f2885ac"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
@ -2053,15 +2053,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-threads-xform"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6961b838d9a9c121ba4a1eea1628014cc759469e3defb42bbac9c5ed0f65be14"
|
||||
checksum = "0d10f9246c4daa911283a7096fc3be9f1fab9e3e36400478a4ab8d7056701420"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
@ -2070,9 +2070,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-wasm-conventions"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0a0eca38fe89471f57d6903f3e17e732d2d6f995a7af5b23f27df7fee0f0d18"
|
||||
checksum = "b4a5ab217f12f73b7c3ff23cbbbb5d36f7ee97dd65bb0be44beebda887df9002"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
@ -2080,9 +2080,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-wasm-interpreter"
|
||||
version = "0.2.81"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b1c9fb7f71137840932bbb853ef1f83d68c88584b716c9bbae38675c9fb8b86"
|
||||
checksum = "8fbb6c773b486889b7c1211d27a7a08eebaf54ec4269380266cadf69e269cd91"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
@ -2196,9 +2196,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -160,7 +160,7 @@ version = "0.9"
|
||||
features = ["wgsl-out"]
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
web-sys = { version = "0.3.58", features = [
|
||||
web-sys = { version = "0.3.60", features = [
|
||||
"Document",
|
||||
"Navigator",
|
||||
"Node",
|
||||
@ -184,6 +184,7 @@ web-sys = { version = "0.3.58", features = [
|
||||
"GpuBufferBindingLayout",
|
||||
"GpuBufferBindingType",
|
||||
"GpuBufferDescriptor",
|
||||
"GpuCanvasAlphaMode",
|
||||
"GpuCanvasContext",
|
||||
"GpuCanvasConfiguration",
|
||||
"GpuColorDict",
|
||||
@ -284,14 +285,14 @@ web-sys = { version = "0.3.58", features = [
|
||||
"ImageBitmapRenderingContext",
|
||||
"Window"
|
||||
] }
|
||||
wasm-bindgen = "0.2.81"
|
||||
js-sys = "0.3.58"
|
||||
wasm-bindgen-futures = "0.4.31"
|
||||
wasm-bindgen = "0.2.83"
|
||||
js-sys = "0.3.60"
|
||||
wasm-bindgen-futures = "0.4.33"
|
||||
# parking_lot 0.12 switches from `winapi` to `windows`; permit either
|
||||
parking_lot = ">=0.11,<0.13"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
console_error_panic_hook = "0.1.6"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
console_log = "0.2"
|
||||
# We need the Location feature in the framework examples
|
||||
web-sys = { version = "0.3.58", features = ["Location"] }
|
||||
web-sys = { version = "0.3.60", features = ["Location"] }
|
||||
|
@ -550,7 +550,6 @@ fn map_texture_format(texture_format: wgt::TextureFormat) -> web_sys::GpuTexture
|
||||
TextureFormat::Depth32FloatStencil8 => tf::Depth32floatStencil8,
|
||||
TextureFormat::Depth24Plus => tf::Depth24plus,
|
||||
TextureFormat::Depth24PlusStencil8 => tf::Depth24plusStencil8,
|
||||
TextureFormat::Depth24UnormStencil8 => tf::Depth24unormStencil8,
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
@ -1239,15 +1238,19 @@ impl crate::Context for Context {
|
||||
if let wgt::PresentMode::Mailbox | wgt::PresentMode::Immediate = config.present_mode {
|
||||
panic!("Only FIFO/Auto* is supported on web");
|
||||
}
|
||||
if let wgt::CompositeAlphaMode::PreMultiplied
|
||||
| wgt::CompositeAlphaMode::PostMultiplied
|
||||
| wgt::CompositeAlphaMode::Inherit = config.alpha_mode
|
||||
if let wgt::CompositeAlphaMode::PostMultiplied | wgt::CompositeAlphaMode::Inherit =
|
||||
config.alpha_mode
|
||||
{
|
||||
panic!("Only Opaque/Auto alpha mode is supported on web");
|
||||
panic!("Only Opaque/Auto or PreMultiplied alpha mode are supported on web");
|
||||
}
|
||||
let alpha_mode = match config.alpha_mode {
|
||||
wgt::CompositeAlphaMode::PreMultiplied => web_sys::GpuCanvasAlphaMode::Premultiplied,
|
||||
_ => web_sys::GpuCanvasAlphaMode::Opaque,
|
||||
};
|
||||
let mut mapped =
|
||||
web_sys::GpuCanvasConfiguration::new(&device.0, map_texture_format(config.format));
|
||||
mapped.usage(config.usage.bits());
|
||||
mapped.alpha_mode(alpha_mode);
|
||||
surface.0.configure(&mapped);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user