wgpu upgraded to 0.15. demo working on linux
This commit is contained in:
parent
8ce0e1c520
commit
2ec63db81d
9 changed files with 266 additions and 33 deletions
241
Cargo.lock
generated
241
Cargo.lock
generated
|
@ -195,9 +195,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ash"
|
name = "ash"
|
||||||
version = "0.37.1+1.3.235"
|
version = "0.37.2+1.3.238"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "911015c962d56e2e4052f40182ca5462ba60a3d2ff04e827c365a0ab3d65726d"
|
checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
]
|
]
|
||||||
|
@ -728,6 +728,12 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "com-rs"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.6"
|
version = "4.6.6"
|
||||||
|
@ -933,7 +939,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"eframe",
|
"eframe",
|
||||||
"egui_glow",
|
"egui_glow",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -943,7 +949,7 @@ dependencies = [
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"eframe",
|
"eframe",
|
||||||
"egui_glow",
|
"egui_glow",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
"three-d",
|
"three-d",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
|
@ -1025,6 +1031,17 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "d3d12"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"libloading",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dark-light"
|
name = "dark-light"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
|
@ -1316,7 +1333,7 @@ dependencies = [
|
||||||
"egui-wgpu",
|
"egui-wgpu",
|
||||||
"egui-winit",
|
"egui-winit",
|
||||||
"egui_glow",
|
"egui_glow",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
"glutin 0.30.2",
|
"glutin 0.30.2",
|
||||||
"image",
|
"image",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -1332,7 +1349,8 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu",
|
"wgpu 0.14.2",
|
||||||
|
"wgpu 0.15.0",
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1360,7 +1378,7 @@ dependencies = [
|
||||||
"puffin",
|
"puffin",
|
||||||
"tracing",
|
"tracing",
|
||||||
"type-map",
|
"type-map",
|
||||||
"wgpu",
|
"wgpu 0.15.0",
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1456,7 +1474,7 @@ dependencies = [
|
||||||
"document-features",
|
"document-features",
|
||||||
"egui",
|
"egui",
|
||||||
"egui-winit",
|
"egui-winit",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
"glutin 0.30.2",
|
"glutin 0.30.2",
|
||||||
"memoffset",
|
"memoffset",
|
||||||
"puffin",
|
"puffin",
|
||||||
|
@ -1953,6 +1971,18 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glow"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8edf6019dff2d92ad27c1e3ff82ad50a0aea5b01370353cc928bfdc33e95925c"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"slotmap",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glutin"
|
name = "glutin"
|
||||||
version = "0.29.1"
|
version = "0.29.1"
|
||||||
|
@ -2100,6 +2130,19 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gpu-allocator"
|
||||||
|
version = "0.21.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "434618454f74b63f9b39328298097256977c41ea0ba9d75a47238b77790b6163"
|
||||||
|
dependencies = [
|
||||||
|
"backtrace",
|
||||||
|
"log",
|
||||||
|
"thiserror",
|
||||||
|
"winapi",
|
||||||
|
"windows 0.43.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-descriptor"
|
name = "gpu-descriptor"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
|
@ -2157,6 +2200,21 @@ dependencies = [
|
||||||
"ahash 0.7.6",
|
"ahash 0.7.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hassle-rs"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"com-rs",
|
||||||
|
"libc",
|
||||||
|
"libloading",
|
||||||
|
"thiserror",
|
||||||
|
"widestring 0.5.1",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -2568,6 +2626,26 @@ dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "naga"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5eafe22a23b797c9bc227c6c896419b26b5bb88fa903417a3adaed08778850d5"
|
||||||
|
dependencies = [
|
||||||
|
"bit-set",
|
||||||
|
"bitflags",
|
||||||
|
"codespan-reporting",
|
||||||
|
"hexf-parse",
|
||||||
|
"indexmap",
|
||||||
|
"log",
|
||||||
|
"num-traits",
|
||||||
|
"rustc-hash",
|
||||||
|
"spirv",
|
||||||
|
"termcolor",
|
||||||
|
"thiserror",
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ndk"
|
name = "ndk"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
@ -3848,7 +3926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7a5a1017829335f6761bdbae2daf3021a88314a1f8d5f188c9b62ce62e2fd31"
|
checksum = "f7a5a1017829335f6761bdbae2daf3021a88314a1f8d5f188c9b62ce62e2fd31"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cgmath",
|
"cgmath",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
"instant",
|
"instant",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"three-d-asset",
|
"three-d-asset",
|
||||||
|
@ -4511,7 +4589,7 @@ dependencies = [
|
||||||
"raw-window-handle 0.5.0",
|
"raw-window-handle 0.5.0",
|
||||||
"url",
|
"url",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"widestring",
|
"widestring 1.0.2",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4558,7 +4636,7 @@ dependencies = [
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga 0.10.0",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"raw-window-handle 0.5.0",
|
"raw-window-handle 0.5.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
@ -4566,9 +4644,33 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-core",
|
"wgpu-core 0.14.2",
|
||||||
"wgpu-hal",
|
"wgpu-hal 0.14.1",
|
||||||
"wgpu-types",
|
"wgpu-types 0.14.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d14c6bfcf3b10f4273f522a95994553c0a5f2934976e62e61a720ae4bc2eb8f2"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec 0.7.2",
|
||||||
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"naga 0.11.0",
|
||||||
|
"parking_lot",
|
||||||
|
"profiling",
|
||||||
|
"raw-window-handle 0.5.0",
|
||||||
|
"smallvec",
|
||||||
|
"static_assertions",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"wgpu-core 0.15.0",
|
||||||
|
"wgpu-hal 0.15.1",
|
||||||
|
"wgpu-types 0.15.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4584,15 +4686,38 @@ dependencies = [
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga 0.10.0",
|
||||||
"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",
|
"wgpu-hal 0.14.1",
|
||||||
"wgpu-types",
|
"wgpu-types 0.14.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-core"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "be1f61be28e557a6ecb2506cac06c63fae3b6d302a006f38195a7a80995abeb9"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec 0.7.2",
|
||||||
|
"bit-vec",
|
||||||
|
"bitflags",
|
||||||
|
"codespan-reporting",
|
||||||
|
"fxhash",
|
||||||
|
"log",
|
||||||
|
"naga 0.11.0",
|
||||||
|
"parking_lot",
|
||||||
|
"profiling",
|
||||||
|
"raw-window-handle 0.5.0",
|
||||||
|
"smallvec",
|
||||||
|
"thiserror",
|
||||||
|
"web-sys",
|
||||||
|
"wgpu-hal 0.15.1",
|
||||||
|
"wgpu-types 0.15.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4608,10 +4733,10 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"block",
|
"block",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"d3d12",
|
"d3d12 0.5.0",
|
||||||
"foreign-types 0.3.2",
|
"foreign-types 0.3.2",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"glow",
|
"glow 0.11.2",
|
||||||
"gpu-alloc",
|
"gpu-alloc",
|
||||||
"gpu-descriptor",
|
"gpu-descriptor",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -4619,7 +4744,7 @@ dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
"log",
|
"log",
|
||||||
"metal",
|
"metal",
|
||||||
"naga",
|
"naga 0.10.0",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"profiling",
|
"profiling",
|
||||||
|
@ -4630,7 +4755,49 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-types",
|
"wgpu-types 0.14.1",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-hal"
|
||||||
|
version = "0.15.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82e95792925fe3d58950b9a5c2a191caa145e2bc570e2d233f0d7320f6a8e814"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"arrayvec 0.7.2",
|
||||||
|
"ash",
|
||||||
|
"bit-set",
|
||||||
|
"bitflags",
|
||||||
|
"block",
|
||||||
|
"core-graphics-types",
|
||||||
|
"d3d12 0.6.0",
|
||||||
|
"foreign-types 0.3.2",
|
||||||
|
"fxhash",
|
||||||
|
"glow 0.12.0",
|
||||||
|
"gpu-alloc",
|
||||||
|
"gpu-allocator",
|
||||||
|
"gpu-descriptor",
|
||||||
|
"hassle-rs",
|
||||||
|
"js-sys",
|
||||||
|
"khronos-egl",
|
||||||
|
"libc",
|
||||||
|
"libloading",
|
||||||
|
"log",
|
||||||
|
"metal",
|
||||||
|
"naga 0.11.0",
|
||||||
|
"objc",
|
||||||
|
"parking_lot",
|
||||||
|
"profiling",
|
||||||
|
"range-alloc",
|
||||||
|
"raw-window-handle 0.5.0",
|
||||||
|
"renderdoc-sys",
|
||||||
|
"smallvec",
|
||||||
|
"thiserror",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
"wgpu-types 0.15.0",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4643,6 +4810,17 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-types"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ecf8cfcbf98f94cc8bd5981544c687140cf9d3948e2ab83849367ead2cd737cf"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"js-sys",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "which"
|
name = "which"
|
||||||
version = "4.3.0"
|
version = "4.3.0"
|
||||||
|
@ -4654,6 +4832,12 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "widestring"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "widestring"
|
name = "widestring"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
@ -4729,6 +4913,21 @@ dependencies = [
|
||||||
"windows_x86_64_msvc 0.42.0",
|
"windows_x86_64_msvc 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows"
|
||||||
|
version = "0.43.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc 0.42.0",
|
||||||
|
"windows_i686_gnu 0.42.0",
|
||||||
|
"windows_i686_msvc 0.42.0",
|
||||||
|
"windows_x86_64_gnu 0.42.0",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc 0.42.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-implement"
|
name = "windows-implement"
|
||||||
version = "0.42.0"
|
version = "0.42.0"
|
||||||
|
|
|
@ -116,7 +116,7 @@ image = { version = "0.24", optional = true, default-features = false, features
|
||||||
"png",
|
"png",
|
||||||
] }
|
] }
|
||||||
puffin = { version = "0.14", optional = true }
|
puffin = { version = "0.14", optional = true }
|
||||||
wgpu = { version = "0.14", optional = true }
|
wgpu = { version = "0.15.0", optional = true }
|
||||||
|
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# web:
|
# web:
|
||||||
|
|
|
@ -226,7 +226,7 @@ pub enum Error {
|
||||||
|
|
||||||
#[cfg(feature = "wgpu")]
|
#[cfg(feature = "wgpu")]
|
||||||
#[error("WGPU error: {0}")]
|
#[error("WGPU error: {0}")]
|
||||||
Wgpu(#[from] wgpu::RequestDeviceError),
|
Wgpu(#[from] egui_wgpu::WgpuError),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
|
@ -958,7 +958,7 @@ mod wgpu_integration {
|
||||||
fn set_window(
|
fn set_window(
|
||||||
&mut self,
|
&mut self,
|
||||||
window: winit::window::Window,
|
window: winit::window::Window,
|
||||||
) -> std::result::Result<(), wgpu::RequestDeviceError> {
|
) -> std::result::Result<(), egui_wgpu::WgpuError> {
|
||||||
self.window = Some(window);
|
self.window = Some(window);
|
||||||
if let Some(running) = &mut self.running {
|
if let Some(running) = &mut self.running {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -970,7 +970,7 @@ mod wgpu_integration {
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
fn drop_window(&mut self) -> std::result::Result<(), wgpu::RequestDeviceError> {
|
fn drop_window(&mut self) -> std::result::Result<(), egui_wgpu::WgpuError> {
|
||||||
self.window = None;
|
self.window = None;
|
||||||
if let Some(running) = &mut self.running {
|
if let Some(running) = &mut self.running {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -985,7 +985,7 @@ mod wgpu_integration {
|
||||||
event_loop: &EventLoopWindowTarget<UserEvent>,
|
event_loop: &EventLoopWindowTarget<UserEvent>,
|
||||||
storage: Option<Box<dyn epi::Storage>>,
|
storage: Option<Box<dyn epi::Storage>>,
|
||||||
window: winit::window::Window,
|
window: winit::window::Window,
|
||||||
) -> std::result::Result<(), wgpu::RequestDeviceError> {
|
) -> std::result::Result<(), egui_wgpu::WgpuError> {
|
||||||
#[allow(unsafe_code, unused_mut, unused_unsafe)]
|
#[allow(unsafe_code, unused_mut, unused_unsafe)]
|
||||||
let painter = unsafe {
|
let painter = unsafe {
|
||||||
let mut painter = egui_wgpu::winit::Painter::new(
|
let mut painter = egui_wgpu::winit::Painter::new(
|
||||||
|
|
|
@ -43,7 +43,7 @@ epaint = { version = "0.20.0", path = "../epaint", default-features = false, fea
|
||||||
bytemuck = "1.7"
|
bytemuck = "1.7"
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
type-map = "0.5.0"
|
type-map = "0.5.0"
|
||||||
wgpu = "0.14"
|
wgpu = "0.15.0"
|
||||||
|
|
||||||
#! ### Optional dependencies
|
#! ### Optional dependencies
|
||||||
## Enable this when generating docs.
|
## Enable this when generating docs.
|
||||||
|
|
|
@ -99,7 +99,35 @@ pub fn preferred_framebuffer_format(formats: &[wgpu::TextureFormat]) -> wgpu::Te
|
||||||
}
|
}
|
||||||
formats[0] // take the first
|
formats[0] // take the first
|
||||||
}
|
}
|
||||||
|
// maybe use this-error?
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum WgpuError {
|
||||||
|
DeviceError(wgpu::RequestDeviceError),
|
||||||
|
SurfaceError(wgpu::CreateSurfaceError),
|
||||||
|
}
|
||||||
|
impl std::fmt::Display for WgpuError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
std::fmt::Debug::fmt(self, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl std::error::Error for WgpuError {
|
||||||
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||||
|
match self {
|
||||||
|
WgpuError::DeviceError(e) => e.source(),
|
||||||
|
WgpuError::SurfaceError(e) => e.source(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<wgpu::RequestDeviceError> for WgpuError {
|
||||||
|
fn from(e: wgpu::RequestDeviceError) -> Self {
|
||||||
|
Self::DeviceError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<wgpu::CreateSurfaceError> for WgpuError {
|
||||||
|
fn from(e: wgpu::CreateSurfaceError) -> Self {
|
||||||
|
Self::SurfaceError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Profiling macro for feature "puffin"
|
/// Profiling macro for feature "puffin"
|
||||||
|
|
|
@ -554,6 +554,7 @@ impl Renderer {
|
||||||
dimension: wgpu::TextureDimension::D2,
|
dimension: wgpu::TextureDimension::D2,
|
||||||
format: wgpu::TextureFormat::Rgba8UnormSrgb, // Minspec for wgpu WebGL emulation is WebGL2, so this should always be supported.
|
format: wgpu::TextureFormat::Rgba8UnormSrgb, // Minspec for wgpu WebGL emulation is WebGL2, so this should always be supported.
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
||||||
|
view_formats: &[wgpu::TextureFormat::Rgba8UnormSrgb],
|
||||||
});
|
});
|
||||||
let sampler = self
|
let sampler = self
|
||||||
.samplers
|
.samplers
|
||||||
|
|
|
@ -42,7 +42,10 @@ impl Painter {
|
||||||
/// a [`winit::window::Window`] with a valid `.raw_window_handle()`
|
/// a [`winit::window::Window`] with a valid `.raw_window_handle()`
|
||||||
/// associated.
|
/// associated.
|
||||||
pub fn new(configuration: WgpuConfiguration, msaa_samples: u32, depth_bits: u8) -> Self {
|
pub fn new(configuration: WgpuConfiguration, msaa_samples: u32, depth_bits: u8) -> Self {
|
||||||
let instance = wgpu::Instance::new(configuration.backends);
|
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
||||||
|
backends: configuration.backends,
|
||||||
|
dx12_shader_compiler: Default::default(), //
|
||||||
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
configuration,
|
configuration,
|
||||||
|
@ -107,7 +110,7 @@ impl Painter {
|
||||||
match &self.adapter {
|
match &self.adapter {
|
||||||
Some(adapter) => {
|
Some(adapter) => {
|
||||||
let swapchain_format = crate::preferred_framebuffer_format(
|
let swapchain_format = crate::preferred_framebuffer_format(
|
||||||
&surface.get_supported_formats(adapter),
|
&surface.get_capabilities(adapter).formats,
|
||||||
);
|
);
|
||||||
let rs = self.init_render_state(adapter, swapchain_format).await?;
|
let rs = self.init_render_state(adapter, swapchain_format).await?;
|
||||||
self.render_state = Some(rs);
|
self.render_state = Some(rs);
|
||||||
|
@ -134,6 +137,7 @@ impl Painter {
|
||||||
height: height_in_pixels,
|
height: height_in_pixels,
|
||||||
present_mode: self.configuration.present_mode,
|
present_mode: self.configuration.present_mode,
|
||||||
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
alpha_mode: wgpu::CompositeAlphaMode::Auto,
|
||||||
|
view_formats: vec![format],
|
||||||
};
|
};
|
||||||
|
|
||||||
let surface_state = self
|
let surface_state = self
|
||||||
|
@ -177,10 +181,10 @@ impl Painter {
|
||||||
pub async unsafe fn set_window(
|
pub async unsafe fn set_window(
|
||||||
&mut self,
|
&mut self,
|
||||||
window: Option<&winit::window::Window>,
|
window: Option<&winit::window::Window>,
|
||||||
) -> Result<(), wgpu::RequestDeviceError> {
|
) -> Result<(), crate::WgpuError> {
|
||||||
match window {
|
match window {
|
||||||
Some(window) => {
|
Some(window) => {
|
||||||
let surface = self.instance.create_surface(&window);
|
let surface = self.instance.create_surface(&window)?;
|
||||||
|
|
||||||
self.ensure_render_state_for_surface(&surface).await?;
|
self.ensure_render_state_for_surface(&surface).await?;
|
||||||
|
|
||||||
|
@ -234,6 +238,7 @@ impl Painter {
|
||||||
format: depth_format,
|
format: depth_format,
|
||||||
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
|
usage: wgpu::TextureUsages::RENDER_ATTACHMENT
|
||||||
| wgpu::TextureUsages::TEXTURE_BINDING,
|
| wgpu::TextureUsages::TEXTURE_BINDING,
|
||||||
|
view_formats: &[depth_format],
|
||||||
})
|
})
|
||||||
.create_view(&wgpu::TextureViewDescriptor::default())
|
.create_view(&wgpu::TextureViewDescriptor::default())
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::{num::NonZeroU64, sync::Arc};
|
use std::{num::NonZeroU64, sync::Arc};
|
||||||
|
|
||||||
use eframe::{
|
use eframe::{
|
||||||
|
egui_wgpu::wgpu::util::DeviceExt,
|
||||||
egui_wgpu::{self, wgpu},
|
egui_wgpu::{self, wgpu},
|
||||||
wgpu::util::DeviceExt,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Custom3d {
|
pub struct Custom3d {
|
||||||
|
|
Loading…
Reference in a new issue