sotrh / learn-wgpu

Guide for using gfx-rs's wgpu library.
https://sotrh.github.io/learn-wgpu/
MIT License
1.51k stars 266 forks source link

Running tutorial11-normals panics on macOS Sonoma after fresh checkout #533

Closed calebharris closed 5 months ago

calebharris commented 9 months ago

It looks like there's a resize call with invalid dimensions that happens soon after the program starts up. The messages starting with "Creating depth texture..." are from a println! I added in Texture::create_depth_texture. Don't have a ton of time to investigate more at the moment, but will keep poking when I can.

macOS version: 14.2.1 (23C71)

Checked out commit: 2bb2f8373b14218ecaa8d136bb172a09786bf38e

caleb@calebs-mb-pro learn-wgpu % cargo run --bin tutorial11-normals
   Compiling autocfg v1.1.0
   Compiling libc v0.2.135
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.60
   Compiling quote v1.0.28
   Compiling unicode-ident v1.0.5
   Compiling syn v1.0.102
   Compiling scopeguard v1.1.0
   Compiling version_check v0.9.4
   Compiling bitflags v1.3.2
   Compiling crossbeam-utils v0.8.12
   Compiling core-foundation-sys v0.8.3
   Compiling log v0.4.17
   Compiling foreign-types-shared v0.1.1
   Compiling cc v1.0.73
   Compiling num-traits v0.2.15
   Compiling lock_api v0.4.9
   Compiling value-bag v1.0.0-alpha.9
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.11
   Compiling syn v2.0.18
   Compiling getrandom v0.2.7
   Compiling core-foundation v0.9.3
   Compiling num_cpus v1.13.1
   Compiling objc_exception v0.1.2
   Compiling indexmap v1.9.3
   Compiling foreign-types v0.3.2
   Compiling rayon-core v1.9.3
   Compiling smallvec v1.10.0
   Compiling futures-core v0.3.24
   Compiling adler v1.0.2
   Compiling core-graphics-types v0.1.1
   Compiling instant v0.1.12
   Compiling hashbrown v0.12.3
   Compiling once_cell v1.18.0
   Compiling termcolor v1.1.3
   Compiling thiserror v1.0.37
   Compiling bitflags v2.3.1
   Compiling paste v1.0.14
   Compiling crc32fast v1.3.2
   Compiling parking_lot_core v0.8.5
   Compiling crossbeam-deque v0.8.2
   Compiling spin v0.9.8
   Compiling nanorand v0.7.0
   Compiling malloc_buf v0.0.6
   Compiling crossbeam-channel v0.5.6
   Compiling rayon v1.5.3
   Compiling objc-sys v0.2.0-beta.2
   Compiling memchr v2.5.0
   Compiling io-lifetimes v1.0.4
   Compiling equivalent v1.0.1
   Compiling foreign-types-shared v0.3.1
   Compiling unicode-width v0.1.10
   Compiling bit-vec v0.6.3
   Compiling futures-sink v0.3.24
   Compiling hashbrown v0.14.2
   Compiling fixedbitset v0.4.2
   Compiling cty v0.2.2
   Compiling bit-set v0.5.3
   Compiling petgraph v0.6.2
   Compiling raw-window-handle v0.5.0
   Compiling codespan-reporting v0.11.1
   Compiling objc v0.2.7
   Compiling indexmap v2.1.0
   Compiling spirv v0.2.0+1.5.4
   Compiling miniz_oxide v0.5.4
   Compiling num-integer v0.1.45
   Compiling either v1.8.0
   Compiling hexf-parse v0.2.1
   Compiling unicode-xid v0.2.4
   Compiling rustix v0.36.16
   Compiling rustc-hash v1.1.0
   Compiling anyhow v1.0.65
   Compiling block v0.1.6
   Compiling flate2 v1.0.24
   Compiling parking_lot v0.11.2
   Compiling wgpu-types v0.18.0
   Compiling errno v0.3.5
   Compiling ahash v0.7.6
   Compiling num-rational v0.4.1
   Compiling arrayvec v0.7.2
   Compiling profiling v1.0.7
   Compiling weezl v0.1.7
   Compiling cfg_aliases v0.1.1
   Compiling aho-corasick v0.7.19
   Compiling winit v0.28.6
   Compiling objc2-encode v2.0.0-pre.2
   Compiling miniz_oxide v0.6.2
   Compiling threadpool v1.8.1
   Compiling fs_extra v1.2.0
   Compiling lebe v0.5.2
   Compiling regex-syntax v0.6.27
   Compiling cgmath v0.18.0
   Compiling half v2.1.0
   Compiling bit_field v0.10.1
   Compiling color_quant v1.1.0
   Compiling glob v0.3.0
   Compiling gif v0.11.4
   Compiling objc2 v0.3.0-beta.3.patch-leaks.3
   Compiling foreign-types-macros v0.2.3
   Compiling bytemuck_derive v1.4.1
   Compiling tutorial11-normals v0.1.0 (/Users/caleb/projects/learn-wgpu/learn-wgpu/code/intermediate/tutorial11-normals)
   Compiling is-terminal v0.4.2
   Compiling ctor v0.1.26
   Compiling thiserror-impl v1.0.37
   Compiling pin-project-internal v1.0.12
   Compiling jpeg-decoder v0.2.6
   Compiling png v0.17.6
   Compiling flume v0.11.0
   Compiling foreign-types v0.5.0
   Compiling approx v0.4.0
   Compiling core-graphics v0.22.3
   Compiling tiff v0.7.3
   Compiling bytemuck v1.13.1
   Compiling regex v1.6.0
   Compiling static_assertions v1.1.0
   Compiling humantime v2.1.0
   Compiling metal v0.27.0
   Compiling scoped_threadpool v0.1.9
   Compiling pin-project v1.0.12
   Compiling dispatch v0.2.0
   Compiling byteorder v1.4.3
   Compiling flume v0.10.14
   Compiling tobj v3.2.3
   Compiling naga v0.14.0
   Compiling env_logger v0.10.0
   Compiling exr v1.5.2
   Compiling pollster v0.3.0
   Compiling image v0.24.4
   Compiling wgpu-hal v0.18.1
   Compiling wgpu-core v0.18.1
   Compiling wgpu v0.18.0
warning: unused import: `std::num::NonZeroU32`
 --> code/intermediate/tutorial11-normals/src/texture.rs:3:5
  |
3 | use std::num::NonZeroU32;
  |     ^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `tutorial11-normals` (lib) generated 1 warning (run `cargo fix --lib -p tutorial11-normals` to apply 1 suggestion)
    Finished dev [unoptimized + debuginfo] target(s) in 14.24s
warning: the following packages contain code that will be rejected by a future version of Rust: fs_extra v1.2.0
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
     Running `target/debug/tutorial11-normals`
Creating depth texture 'depth_texture': 1600x1200
2024-02-10 11:01:23.707 tutorial11-normals[98283:10280500] CAMetalLayer ignoring invalid setDrawableSize width=4294967295.000000 height=4294967295.000000
Creating depth texture 'depth_texture': 4294967295x4294967295
[2024-02-10T16:01:23Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at /Users/caleb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:3111:5:
wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `depth_texture`
    Dimension X value 4294967295 exceeds the limit of 8192

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
sotrh commented 5 months ago

Winit has been updated so this should be fixed