upgrade wgpu for eframe web backend
This commit is contained in:
parent
2ec63db81d
commit
1525e90183
3 changed files with 23 additions and 142 deletions
150
Cargo.lock
generated
150
Cargo.lock
generated
|
@ -1020,17 +1020,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "d3d12"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"libloading",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
@ -1349,8 +1338,7 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu 0.14.2",
|
"wgpu",
|
||||||
"wgpu 0.15.0",
|
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1378,7 +1366,7 @@ dependencies = [
|
||||||
"puffin",
|
"puffin",
|
||||||
"tracing",
|
"tracing",
|
||||||
"type-map",
|
"type-map",
|
||||||
"wgpu 0.15.0",
|
"wgpu",
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2606,26 +2594,6 @@ dependencies = [
|
||||||
"windows-sys 0.42.0",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "naga"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707"
|
|
||||||
dependencies = [
|
|
||||||
"bit-set",
|
|
||||||
"bitflags",
|
|
||||||
"codespan-reporting",
|
|
||||||
"hexf-parse",
|
|
||||||
"indexmap",
|
|
||||||
"log",
|
|
||||||
"num-traits",
|
|
||||||
"rustc-hash",
|
|
||||||
"spirv",
|
|
||||||
"termcolor",
|
|
||||||
"thiserror",
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "naga"
|
name = "naga"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
|
@ -4627,28 +4595,6 @@ dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wgpu"
|
|
||||||
version = "0.14.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937"
|
|
||||||
dependencies = [
|
|
||||||
"arrayvec 0.7.2",
|
|
||||||
"js-sys",
|
|
||||||
"log",
|
|
||||||
"naga 0.10.0",
|
|
||||||
"parking_lot",
|
|
||||||
"raw-window-handle 0.5.0",
|
|
||||||
"smallvec",
|
|
||||||
"static_assertions",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web-sys",
|
|
||||||
"wgpu-core 0.14.2",
|
|
||||||
"wgpu-hal 0.14.1",
|
|
||||||
"wgpu-types 0.14.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu"
|
name = "wgpu"
|
||||||
version = "0.15.0"
|
version = "0.15.0"
|
||||||
|
@ -4659,7 +4605,7 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"naga 0.11.0",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
"raw-window-handle 0.5.0",
|
"raw-window-handle 0.5.0",
|
||||||
|
@ -4668,33 +4614,9 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-core 0.15.0",
|
"wgpu-core",
|
||||||
"wgpu-hal 0.15.1",
|
"wgpu-hal",
|
||||||
"wgpu-types 0.15.0",
|
"wgpu-types",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wgpu-core"
|
|
||||||
version = "0.14.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca"
|
|
||||||
dependencies = [
|
|
||||||
"arrayvec 0.7.2",
|
|
||||||
"bit-vec",
|
|
||||||
"bitflags",
|
|
||||||
"cfg_aliases",
|
|
||||||
"codespan-reporting",
|
|
||||||
"fxhash",
|
|
||||||
"log",
|
|
||||||
"naga 0.10.0",
|
|
||||||
"parking_lot",
|
|
||||||
"profiling",
|
|
||||||
"raw-window-handle 0.5.0",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror",
|
|
||||||
"web-sys",
|
|
||||||
"wgpu-hal 0.14.1",
|
|
||||||
"wgpu-types 0.14.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4709,54 +4631,15 @@ dependencies = [
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"naga 0.11.0",
|
"naga",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
"raw-window-handle 0.5.0",
|
"raw-window-handle 0.5.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-hal 0.15.1",
|
"wgpu-hal",
|
||||||
"wgpu-types 0.15.0",
|
"wgpu-types",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wgpu-hal"
|
|
||||||
version = "0.14.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f"
|
|
||||||
dependencies = [
|
|
||||||
"android_system_properties",
|
|
||||||
"arrayvec 0.7.2",
|
|
||||||
"ash",
|
|
||||||
"bit-set",
|
|
||||||
"bitflags",
|
|
||||||
"block",
|
|
||||||
"core-graphics-types",
|
|
||||||
"d3d12 0.5.0",
|
|
||||||
"foreign-types 0.3.2",
|
|
||||||
"fxhash",
|
|
||||||
"glow 0.11.2",
|
|
||||||
"gpu-alloc",
|
|
||||||
"gpu-descriptor",
|
|
||||||
"js-sys",
|
|
||||||
"khronos-egl",
|
|
||||||
"libloading",
|
|
||||||
"log",
|
|
||||||
"metal",
|
|
||||||
"naga 0.10.0",
|
|
||||||
"objc",
|
|
||||||
"parking_lot",
|
|
||||||
"profiling",
|
|
||||||
"range-alloc",
|
|
||||||
"raw-window-handle 0.5.0",
|
|
||||||
"renderdoc-sys",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"web-sys",
|
|
||||||
"wgpu-types 0.14.1",
|
|
||||||
"winapi",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4772,7 +4655,7 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"d3d12 0.6.0",
|
"d3d12",
|
||||||
"foreign-types 0.3.2",
|
"foreign-types 0.3.2",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"glow 0.12.0",
|
"glow 0.12.0",
|
||||||
|
@ -4786,7 +4669,7 @@ dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
"naga 0.11.0",
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
|
@ -4797,19 +4680,10 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-types 0.15.0",
|
"wgpu-types",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wgpu-types"
|
|
||||||
version = "0.14.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wgpu-types"
|
name = "wgpu-types"
|
||||||
version = "0.15.0"
|
version = "0.15.0"
|
||||||
|
|
|
@ -172,4 +172,4 @@ web-sys = { version = "0.3.58", features = [
|
||||||
# optional web:
|
# optional web:
|
||||||
egui-wgpu = { version = "0.20.0", path = "../egui-wgpu", optional = true } # if wgpu is used, use it without (!) winit
|
egui-wgpu = { version = "0.20.0", path = "../egui-wgpu", optional = true } # if wgpu is used, use it without (!) winit
|
||||||
tts = { version = "0.24", optional = true }
|
tts = { version = "0.24", optional = true }
|
||||||
wgpu = { version = "0.14", optional = true, features = ["webgl"] }
|
wgpu = { version = "0.15.0", optional = true, features = ["webgl"] }
|
||||||
|
|
|
@ -49,6 +49,7 @@ impl WebPainterWgpu {
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: depth_format,
|
format: depth_format,
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
|
||||||
|
view_formats: &[depth_format],
|
||||||
})
|
})
|
||||||
.create_view(&wgpu::TextureViewDescriptor::default())
|
.create_view(&wgpu::TextureViewDescriptor::default())
|
||||||
})
|
})
|
||||||
|
@ -60,8 +61,13 @@ impl WebPainterWgpu {
|
||||||
|
|
||||||
let canvas = super::canvas_element_or_die(canvas_id);
|
let canvas = super::canvas_element_or_die(canvas_id);
|
||||||
|
|
||||||
let instance = wgpu::Instance::new(options.wgpu_options.backends);
|
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||||
let surface = instance.create_surface_from_canvas(&canvas);
|
backends: options.wgpu_options.backends,
|
||||||
|
dx12_shader_compiler: Default::default(),
|
||||||
|
});
|
||||||
|
let surface = instance
|
||||||
|
.create_surface_from_canvas(&canvas)
|
||||||
|
.map_err(|err| format!("failed to create wgpu surface: {err}"))?;
|
||||||
|
|
||||||
let adapter = instance
|
let adapter = instance
|
||||||
.request_adapter(&wgpu::RequestAdapterOptions {
|
.request_adapter(&wgpu::RequestAdapterOptions {
|
||||||
|
@ -81,7 +87,7 @@ impl WebPainterWgpu {
|
||||||
.map_err(|err| format!("Failed to find wgpu device: {}", err))?;
|
.map_err(|err| format!("Failed to find wgpu device: {}", err))?;
|
||||||
|
|
||||||
let target_format =
|
let target_format =
|
||||||
egui_wgpu::preferred_framebuffer_format(&surface.get_supported_formats(&adapter));
|
egui_wgpu::preferred_framebuffer_format(&surface.get_capabilities(&adapter).formats);
|
||||||
|
|
||||||
let depth_format = options.wgpu_options.depth_format;
|
let depth_format = options.wgpu_options.depth_format;
|
||||||
let renderer = egui_wgpu::Renderer::new(&device, target_format, depth_format, 1);
|
let renderer = egui_wgpu::Renderer::new(&device, target_format, depth_format, 1);
|
||||||
|
@ -99,6 +105,7 @@ impl WebPainterWgpu {
|
||||||
height: 0,
|
height: 0,
|
||||||
present_mode: options.wgpu_options.present_mode,
|
present_mode: options.wgpu_options.present_mode,
|
||||||
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
||||||
|
view_formats: vec![target_format],
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::debug!("wgpu painter initialized.");
|
tracing::debug!("wgpu painter initialized.");
|
||||||
|
|
Loading…
Reference in a new issue