mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-15 21:00:20 +00:00
Merge pull request #1216 from hannobraun/wgpu
Fix some `wgpu`/`egui-winit` errors and warnings
This commit is contained in:
commit
75db7adc28
228
Cargo.lock
generated
228
Cargo.lock
generated
@ -98,23 +98,6 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arboard"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc120354d1b5ec6d7aaf4876b602def75595937b5e15d356eb554ab5177e08bb"
|
||||
dependencies = [
|
||||
"clipboard-win",
|
||||
"log",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"parking_lot",
|
||||
"thiserror",
|
||||
"winapi",
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.5.1"
|
||||
@ -317,7 +300,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a22a6a8f622f797120d452c630b0ab12e1331a1a753e2039ce7868d4ac77b4ee"
|
||||
dependencies = [
|
||||
"log",
|
||||
"nix 0.24.2",
|
||||
"nix",
|
||||
"slotmap",
|
||||
"thiserror",
|
||||
"vec_map",
|
||||
@ -360,12 +343,6 @@ version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cesu8"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
@ -431,17 +408,6 @@ dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219"
|
||||
dependencies = [
|
||||
"error-code",
|
||||
"str-buf",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.48"
|
||||
@ -517,16 +483,6 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "combine"
|
||||
version = "4.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "copyless"
|
||||
version = "0.1.5"
|
||||
@ -864,12 +820,9 @@ version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07ddc525334c416e11580123e147b970f738507f427c9fb1cd09ea2dd7416a3a"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"egui",
|
||||
"instant",
|
||||
"smithay-clipboard",
|
||||
"tracing",
|
||||
"webbrowser",
|
||||
"winit",
|
||||
]
|
||||
|
||||
@ -925,16 +878,6 @@ dependencies = [
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-code"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"str-buf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "expat-sys"
|
||||
version = "2.1.6"
|
||||
@ -1335,16 +1278,6 @@ dependencies = [
|
||||
"byteorder 1.4.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.7"
|
||||
@ -1701,20 +1634,6 @@ version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
|
||||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
|
||||
dependencies = [
|
||||
"cesu8",
|
||||
"combine",
|
||||
"jni-sys",
|
||||
"log",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jni-sys"
|
||||
version = "0.3.0"
|
||||
@ -2018,19 +1937,6 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"jni-sys",
|
||||
"ndk-sys 0.3.0",
|
||||
"num_enum",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk"
|
||||
version = "0.7.0"
|
||||
@ -2039,7 +1945,7 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"jni-sys",
|
||||
"ndk-sys 0.4.0",
|
||||
"ndk-sys",
|
||||
"num_enum",
|
||||
"raw-window-handle 0.5.0",
|
||||
"thiserror",
|
||||
@ -2051,21 +1957,6 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
|
||||
|
||||
[[package]]
|
||||
name = "ndk-glue"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d0c4a7b83860226e6b4183edac21851f05d5a51756e97a1144b7f5a6b63e65f"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"ndk 0.6.0",
|
||||
"ndk-context",
|
||||
"ndk-macro",
|
||||
"ndk-sys 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-glue"
|
||||
version = "0.7.0"
|
||||
@ -2074,10 +1965,10 @@ checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"ndk 0.7.0",
|
||||
"ndk",
|
||||
"ndk-context",
|
||||
"ndk-macro",
|
||||
"ndk-sys 0.4.0",
|
||||
"ndk-sys",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
]
|
||||
@ -2095,15 +1986,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97"
|
||||
dependencies = [
|
||||
"jni-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.4.0"
|
||||
@ -2113,19 +1995,6 @@ dependencies = [
|
||||
"jni-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.22.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.24.2"
|
||||
@ -2294,17 +2163,6 @@ dependencies = [
|
||||
"objc_exception",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-foundation"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
|
||||
dependencies = [
|
||||
"block",
|
||||
"objc",
|
||||
"objc_id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
@ -2314,15 +2172,6 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_id"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
|
||||
dependencies = [
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.29.0"
|
||||
@ -3198,23 +3047,13 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memmap2",
|
||||
"nix 0.24.2",
|
||||
"nix",
|
||||
"pkg-config",
|
||||
"wayland-client",
|
||||
"wayland-cursor",
|
||||
"wayland-protocols",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-clipboard"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8"
|
||||
dependencies = [
|
||||
"smithay-client-toolkit",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snafu"
|
||||
version = "0.7.2"
|
||||
@ -3305,12 +3144,6 @@ dependencies = [
|
||||
"byteorder 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "str-buf"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
@ -3837,7 +3670,7 @@ dependencies = [
|
||||
"bitflags",
|
||||
"downcast-rs",
|
||||
"libc",
|
||||
"nix 0.24.2",
|
||||
"nix",
|
||||
"scoped-tls",
|
||||
"wayland-commons",
|
||||
"wayland-scanner",
|
||||
@ -3850,7 +3683,7 @@ version = "0.29.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
|
||||
dependencies = [
|
||||
"nix 0.24.2",
|
||||
"nix",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
@ -3862,7 +3695,7 @@ version = "0.29.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
|
||||
dependencies = [
|
||||
"nix 0.24.2",
|
||||
"nix",
|
||||
"wayland-client",
|
||||
"xcursor",
|
||||
]
|
||||
@ -3911,20 +3744,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webbrowser"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc6a3cffdb686fbb24d9fb8f03a213803277ed2300f11026a3afe1f108dc021b"
|
||||
dependencies = [
|
||||
"jni",
|
||||
"ndk-glue 0.6.2",
|
||||
"url",
|
||||
"web-sys",
|
||||
"widestring",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.13.1"
|
||||
@ -4041,12 +3860,6 @@ dependencies = [
|
||||
"safe_arch 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@ -4072,15 +3885,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-wsapoll"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
@ -4145,8 +3949,8 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"mio",
|
||||
"ndk 0.7.0",
|
||||
"ndk-glue 0.7.0",
|
||||
"ndk",
|
||||
"ndk-glue",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
@ -4192,18 +3996,6 @@ dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11rb"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"nix 0.22.3",
|
||||
"winapi",
|
||||
"winapi-wsapoll",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcursor"
|
||||
version = "0.3.4"
|
||||
|
@ -1,9 +1,3 @@
|
||||
struct VertexOutput {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
@location(0) normal: vec3<f32>,
|
||||
@location(1) color: vec4<f32>,
|
||||
};
|
||||
|
||||
struct Uniforms {
|
||||
transform: mat4x4<f32>,
|
||||
transform_normals: mat4x4<f32>,
|
||||
@ -12,19 +6,29 @@ struct Uniforms {
|
||||
@group(0) @binding(0)
|
||||
var<uniform> uniforms: Uniforms;
|
||||
|
||||
@vertex
|
||||
fn vertex(
|
||||
struct VertexInput {
|
||||
@location(0) position: vec3<f32>,
|
||||
@location(1) normal: vec3<f32>,
|
||||
@location(2) color: vec4<f32>,
|
||||
)
|
||||
-> VertexOutput
|
||||
{
|
||||
}
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
@location(0) normal: vec3<f32>,
|
||||
@location(1) color: vec4<f32>,
|
||||
};
|
||||
|
||||
struct FragmentOutput {
|
||||
@location(0) color: vec4<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex(in: VertexInput) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.normal = (uniforms.transform_normals * vec4<f32>(normal, 0.0)).xyz;
|
||||
out.position = uniforms.transform * vec4<f32>(position, 1.0);
|
||||
out.normal = (uniforms.transform_normals * vec4<f32>(in.normal, 0.0)).xyz;
|
||||
out.position = uniforms.transform * vec4<f32>(in.position, 1.0);
|
||||
// We use premultiplied alpha blending.
|
||||
out.color = vec4<f32>(color.rgb * color.a, color.a);
|
||||
out.color = vec4<f32>(in.color.rgb * in.color.a, in.color.a);
|
||||
|
||||
return out;
|
||||
}
|
||||
@ -32,7 +36,7 @@ fn vertex(
|
||||
let pi: f32 = 3.14159265359;
|
||||
|
||||
@fragment
|
||||
fn frag_model(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
fn frag_model(in: VertexOutput) -> FragmentOutput {
|
||||
let light = vec3<f32>(0.0, 0.0, -1.0);
|
||||
|
||||
let angle = acos(dot(light, -in.normal));
|
||||
@ -40,17 +44,22 @@ fn frag_model(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
|
||||
let f_normal = max(1.0 - f_angle, 0.0);
|
||||
|
||||
let color = vec4<f32>(in.color.rgb * f_normal, in.color.a);
|
||||
var out: FragmentOutput;
|
||||
out.color = vec4<f32>(in.color.rgb * f_normal, in.color.a);
|
||||
|
||||
return color;
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn frag_mesh(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(1.0 - in.color.rgb, in.color.a);
|
||||
fn frag_mesh(in: VertexOutput) -> FragmentOutput {
|
||||
var out: FragmentOutput;
|
||||
out.color = vec4<f32>(1.0 - in.color.rgb, in.color.a);
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn frag_lines(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(in.color.rgb, in.color.a);
|
||||
fn frag_lines(in: VertexOutput) -> FragmentOutput {
|
||||
var out: FragmentOutput;
|
||||
out.color = vec4<f32>(in.color.rgb, in.color.a);
|
||||
return out;
|
||||
}
|
||||
|
@ -15,8 +15,11 @@ fj-host.workspace = true
|
||||
fj-operations.workspace = true
|
||||
fj-viewer.workspace = true
|
||||
fj-interop.workspace = true
|
||||
egui-winit = "0.19.0"
|
||||
futures = "0.3.24"
|
||||
thiserror = "1.0.35"
|
||||
tracing = "0.1.37"
|
||||
winit = "0.27.4"
|
||||
|
||||
[dependencies.egui-winit]
|
||||
version = "0.19.0"
|
||||
default-features = false
|
||||
|
@ -51,6 +51,12 @@ pub fn run(
|
||||
let mut camera = Camera::new(&Default::default());
|
||||
let mut camera_update_once = watcher.is_some();
|
||||
|
||||
// Only handle resize events once every frame. This filters out spurious
|
||||
// resize events that can lead to wgpu warnings. See this issue for some
|
||||
// context:
|
||||
// https://github.com/rust-windowing/winit/issues/2094
|
||||
let mut new_size = None;
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
trace!("Handling event: {:?}", event);
|
||||
|
||||
@ -90,8 +96,6 @@ pub fn run(
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if let Event::WindowEvent {
|
||||
event: window_event,
|
||||
..
|
||||
@ -149,11 +153,10 @@ pub fn run(
|
||||
event: WindowEvent::Resized(size),
|
||||
..
|
||||
} => {
|
||||
let size = Size {
|
||||
new_size = Some(Size {
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
};
|
||||
renderer.handle_resize(size);
|
||||
});
|
||||
}
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::MouseInput { state, button, .. },
|
||||
@ -171,6 +174,9 @@ pub fn run(
|
||||
if let Some(shape) = &shape {
|
||||
camera.update_planes(&shape.aabb);
|
||||
}
|
||||
if let Some(size) = new_size.take() {
|
||||
renderer.handle_resize(size);
|
||||
}
|
||||
|
||||
let egui_input =
|
||||
egui_winit_state.take_egui_input(window.window());
|
||||
|
Loading…
Reference in New Issue
Block a user