wgpu: Bump to wgpu 23.0.0 and wasm-bindgen to 0.2.95 (#5330)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
This commit is contained in:
parent
5bfff316c9
commit
67c82ed5f2
|
|
@ -103,7 +103,7 @@ jobs:
|
|||
- name: wasm-bindgen
|
||||
uses: jetli/wasm-bindgen-action@v0.1.0
|
||||
with:
|
||||
version: "0.2.93"
|
||||
version: "0.2.95"
|
||||
|
||||
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
|
||||
|
||||
|
|
|
|||
941
Cargo.lock
941
Cargo.lock
File diff suppressed because it is too large
Load Diff
|
|
@ -82,7 +82,7 @@ glutin = "0.32.0"
|
|||
glutin-winit = "0.5.0"
|
||||
home = "0.5.9"
|
||||
image = { version = "0.25", default-features = false }
|
||||
kittest = { git = "https://github.com/rerun-io/kittest", version = "0.1", branch = "main"}
|
||||
kittest = { git = "https://github.com/rerun-io/kittest", version = "0.1", branch = "main" }
|
||||
log = { version = "0.4", features = ["std"] }
|
||||
nohash-hasher = "0.2"
|
||||
parking_lot = "0.12"
|
||||
|
|
@ -97,8 +97,8 @@ web-time = "1.1.0" # Timekeeping for native and web
|
|||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
web-sys = "0.3.70"
|
||||
wgpu = { version = "22.1.0", default-features = false }
|
||||
windows-sys = "0.52"
|
||||
wgpu = { version = "23.0.0", default-features = false }
|
||||
windows-sys = "0.59"
|
||||
winit = { version = "0.30.5", default-features = false }
|
||||
|
||||
[workspace.lints.rust]
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ fn roaming_appdata() -> Option<PathBuf> {
|
|||
match SHGetKnownFolderPath(
|
||||
&FOLDERID_RoamingAppData,
|
||||
KF_FLAG_DONT_VERIFY as u32,
|
||||
0,
|
||||
std::ptr::null_mut(),
|
||||
&mut path,
|
||||
) {
|
||||
S_OK => {
|
||||
|
|
|
|||
|
|
@ -114,62 +114,13 @@ impl WebPainterWgpu {
|
|||
}
|
||||
|
||||
log::debug!("Creating wgpu instance with backends {:?}", backends);
|
||||
let mut instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
backends,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
// It can happen that a browser advertises WebGPU support, but then fails to create a
|
||||
// suitable adapter. As of writing this happens for example on Linux with Chrome 121.
|
||||
//
|
||||
// Since WebGPU is handled in a special way in wgpu, we have to recreate the instance
|
||||
// if we instead want to try with WebGL.
|
||||
//
|
||||
// To make matters worse, once a canvas has been used with either WebGL or WebGPU,
|
||||
// we can't go back and change that without replacing the canvas (which is hard to do from here).
|
||||
// Therefore, we have to create the surface *after* requesting the adapter.
|
||||
// However, wgpu offers to pass in a surface on adapter creation to ensure it is actually compatible with the chosen backend.
|
||||
// This in turn isn't all that important on the web, but it still makes sense for the design of
|
||||
// `egui::RenderState`!
|
||||
// Therefore, we have to first check if it's possible to create a WebGPU adapter,
|
||||
// and if it is not, start over with a WebGL instance.
|
||||
//
|
||||
// Note that we also might needlessly try this here if wgpu already determined that there's no
|
||||
// WebGPU support in the first place. This is not a huge problem since it fails very fast, but
|
||||
// it would be nice to avoid this. See https://github.com/gfx-rs/wgpu/issues/5142
|
||||
if backends.contains(wgpu::Backends::BROWSER_WEBGPU) {
|
||||
log::debug!("Attempting to create WebGPU adapter to check for support.");
|
||||
if let Some(adapter) = instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||
power_preference: *power_preference,
|
||||
compatible_surface: None,
|
||||
force_fallback_adapter: false,
|
||||
})
|
||||
.await
|
||||
{
|
||||
// WebGPU doesn't spec yet a destroy on the adapter, only on the device.
|
||||
//adapter.destroy();
|
||||
log::debug!(
|
||||
"Successfully created WebGPU adapter, WebGPU confirmed to be supported!"
|
||||
);
|
||||
} else {
|
||||
log::debug!("Failed to create WebGPU adapter.");
|
||||
|
||||
if backends.contains(wgpu::Backends::GL) {
|
||||
log::debug!("Recreating wgpu instance with WebGL backend only.");
|
||||
backends = wgpu::Backends::GL;
|
||||
instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||
backends,
|
||||
..Default::default()
|
||||
});
|
||||
} else {
|
||||
return Err(
|
||||
"Failed to create WebGPU adapter and WebGL was not enabled."
|
||||
.to_owned(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
let instance =
|
||||
wgpu::util::new_instance_with_webgpu_detection(wgpu::InstanceDescriptor {
|
||||
backends,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
|
||||
// On wasm, depending on feature flags, wgpu objects may or may not implement sync.
|
||||
// It doesn't make sense to switch to Rc for that special usecase, so simply disable the lint.
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ impl Renderer {
|
|||
label: Some("egui_pipeline"),
|
||||
layout: Some(&pipeline_layout),
|
||||
vertex: wgpu::VertexState {
|
||||
entry_point: "vs_main",
|
||||
entry_point: Some("vs_main"),
|
||||
module: &module,
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: 5 * 4,
|
||||
|
|
@ -343,12 +343,12 @@ impl Renderer {
|
|||
|
||||
fragment: Some(wgpu::FragmentState {
|
||||
module: &module,
|
||||
entry_point: if output_color_format.is_srgb() {
|
||||
entry_point: Some(if output_color_format.is_srgb() {
|
||||
log::warn!("Detected a linear (sRGBA aware) framebuffer {:?}. egui prefers Rgba8Unorm or Bgra8Unorm", output_color_format);
|
||||
"fs_main_linear_framebuffer"
|
||||
} else {
|
||||
"fs_main_gamma_framebuffer" // this is what we prefer
|
||||
},
|
||||
}),
|
||||
targets: &[Some(wgpu::ColorTargetState {
|
||||
format: output_color_format,
|
||||
blend: Some(wgpu::BlendState {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,6 @@ rfd = { version = "0.13", optional = true }
|
|||
|
||||
# web:
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
wasm-bindgen = "=0.2.93"
|
||||
wasm-bindgen = "=0.2.95"
|
||||
wasm-bindgen-futures.workspace = true
|
||||
web-sys.workspace = true
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ impl Custom3d {
|
|||
layout: Some(&pipeline_layout),
|
||||
vertex: wgpu::VertexState {
|
||||
module: &shader,
|
||||
entry_point: "vs_main",
|
||||
entry_point: None,
|
||||
buffers: &[],
|
||||
compilation_options: wgpu::PipelineCompilationOptions::default(),
|
||||
},
|
||||
fragment: Some(wgpu::FragmentState {
|
||||
module: &shader,
|
||||
entry_point: "fs_main",
|
||||
entry_point: Some("fs_main"),
|
||||
targets: &[Some(wgpu_render_state.target_format.into())],
|
||||
compilation_options: wgpu::PipelineCompilationOptions::default(),
|
||||
}),
|
||||
|
|
|
|||
16
deny.toml
16
deny.toml
|
|
@ -31,11 +31,9 @@ all-features = true
|
|||
[advisories]
|
||||
version = 2
|
||||
ignore = [
|
||||
"RUSTSEC-2024-0320", # unmaintaines yaml-rust pulled in by syntect
|
||||
{ name = "async-process" }, # yanked crated pulled in by old accesskit
|
||||
"RUSTSEC-2024-0320", # unmaintaines yaml-rust pulled in by syntect
|
||||
]
|
||||
|
||||
|
||||
[bans]
|
||||
multiple-versions = "deny"
|
||||
wildcards = "deny"
|
||||
|
|
@ -46,7 +44,7 @@ deny = [
|
|||
]
|
||||
|
||||
skip = [
|
||||
{ name = "bit-set" }, # wgpu's naga depends on 0.6, syntect's (used by egui_extras) fancy-regex depends on 0.5
|
||||
{ name = "bit-set" }, # wgpu's naga depends on 0.8, syntect's (used by egui_extras) fancy-regex depends on 0.5
|
||||
{ name = "bit-vec" }, # dependency of bit-set in turn, different between 0.6 and 0.5
|
||||
{ name = "bitflags" }, # old 1.0 version via glutin, png, spirv, …
|
||||
{ name = "cfg_aliases" }, # old version via wgpu
|
||||
|
|
@ -57,16 +55,12 @@ skip = [
|
|||
{ name = "quick-xml" }, # old version via wayland-scanner
|
||||
{ name = "redox_syscall" }, # old version via winit
|
||||
{ name = "time" }, # old version pulled in by unmaintianed crate 'chrono'
|
||||
{ name = "windows-core" }, # old version via accesskit_windows
|
||||
{ name = "windows" }, # old version via accesskit_windows
|
||||
{ name = "glow" }, # wgpu uses an old `glow`, but realistically no one uses _both_ `egui_wgpu` and `egui_glow`, so we won't get a duplicate dependency
|
||||
{ name = "windows-core" }, # Chrono pulls in 0.51, accesskit uses 0.58.0
|
||||
{ name = "windows-sys" }, # glutin pulls in 0.52.0, accesskit pulls in 0.59.0, rfd pulls 0.48, webbrowser pulls 0.45.0 (via jni)
|
||||
]
|
||||
skip-tree = [
|
||||
{ name = "criterion" }, # dev-dependency
|
||||
{ name = "fastrand" }, # old version via accesskit_unix
|
||||
{ name = "foreign-types" }, # small crate. Old version via core-graphics (winit).
|
||||
{ name = "objc2" }, # old version via accesskit_macos
|
||||
{ name = "polling" }, # old version via accesskit_unix
|
||||
{ name = "rfd" }, # example dependency
|
||||
]
|
||||
|
||||
|
|
@ -110,5 +104,5 @@ unknown-registry = "deny"
|
|||
unknown-git = "deny"
|
||||
|
||||
allow-git = [
|
||||
"https://github.com/rerun-io/kittest", # TODO(lucasmerlin): remove this once the kittest crate is published"
|
||||
"https://github.com/rerun-io/kittest", # TODO(lucasmerlin): remove this once the kittest crate is published"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ WASM_OPT_FLAGS="-O2 --fast-math"
|
|||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
echo "build_demo_web.sh [--release] [--webgpu] [--open]"
|
||||
echo "build_demo_web.sh [--release] [--wgpu] [--open]"
|
||||
echo ""
|
||||
echo " -g: Keep debug symbols even with --release."
|
||||
echo " These are useful profiling and size trimming."
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ cd "$script_path/.."
|
|||
rustup target add wasm32-unknown-unknown
|
||||
|
||||
# For generating JS bindings:
|
||||
cargo install --quiet wasm-bindgen-cli --version 0.2.93
|
||||
cargo install --quiet wasm-bindgen-cli --version 0.2.95
|
||||
|
|
|
|||
Loading…
Reference in New Issue