darthdeus/comfy

Surface::configure: Validation Error on master branch Mac m2

Sigmoidle opened this issue · 2 comments

OS: MacOS Sonoma
CPU: M2
Comfy Commit: 052307e on master

Here is my simple game: https://github.com/Sigmoidle/cat_ball_wow

When running cargo run I get this error.

LOGGER: env_logger
thread 'main' panicked at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:778:18:
Error in Surface::configure: Validation Error

Caused by:
    Requested usage is not supported

stack backtrace:
   0:        0x103a21480 - std::backtrace_rs::backtrace::libunwind::trace::hadefa2fe489b32be
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:        0x103a21480 - std::backtrace_rs::backtrace::trace_unsynchronized::h37e8bb3c3fd9c67c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x103a21480 - std::sys_common::backtrace::_print_fmt::h4994a90b70e9aaa7
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:        0x103a21480 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb478ebbfb46e27ce
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x103a3cec0 - core::fmt::rt::Argument::fmt::hfe2e626e52db21d5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:        0x103a3cec0 - core::fmt::write::he4d5fa2daff1f531
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:        0x103a1f640 - std::io::Write::write_fmt::hc5a47a68eba63d9f
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:        0x103a212b4 - std::sys_common::backtrace::_print::hd47355bf70e1c2da
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:        0x103a212b4 - std::sys_common::backtrace::print::h79bd952cc5812e7a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:        0x103a22840 - std::panicking::default_hook::{{closure}}::h82301f6222887737
  10:        0x103a22588 - std::panicking::default_hook::h1e49abbb3f1d7dbf
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:        0x103a22c88 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:779:13
  12:        0x103a22b7c - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
  13:        0x103a21904 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  14:        0x103a22904 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  15:        0x103a8b6a0 - core::panicking::panic_fmt::h33e40d2a93cab78f
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  16:        0x102f45200 - wgpu::backend::direct::Context::handle_error_fatal::hd51fdf0490bb2489
                               at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:354:9
  17:        0x102f4ab78 - <wgpu::backend::direct::Context as wgpu::context::Context>::surface_configure::hee022a8775740d2d
                               at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:778:13
  18:        0x102f5fc80 - <T as wgpu::context::DynContext>::surface_configure::hd1d278d66aaf1c65
                               at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/context.rs:2196:9
  19:        0x102f81be4 - wgpu::Surface::configure::he55bf9c85e2d2193
                               at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/lib.rs:4925:9
  20:        0x102d44cb0 - comfy_wgpu::device::create_graphics_context::{{closure}}::h30e87ecca87b9385
                               at /Users/sigmoid/.cargo/git/checkouts/comfy_touch_support-d720c83557467eae/052307e/comfy-wgpu/src/device.rs:141:5
  21:        0x102d3b0b0 - comfy_wgpu::renderer::WgpuRenderer::new::{{closure}}::hcc610161bf5ffddc
                               at /Users/sigmoid/.cargo/git/checkouts/comfy_touch_support-d720c83557467eae/052307e/comfy-wgpu/src/renderer.rs:124:56
  22:        0x102d4d3a0 - comfy::game_loop::run_comfy_main_async::{{closure}}::hb2a0d238db2ed29c
                               at /Users/sigmoid/.cargo/git/checkouts/comfy_touch_support-d720c83557467eae/052307e/comfy/src/game_loop.rs:124:58
  23:        0x102d2e044 - learning_comfy::run::{{closure}}::h173ed915a32d5f7f
                               at /Users/sigmoid/.cargo/git/checkouts/comfy_touch_support-d720c83557467eae/052307e/comfy/src/macros.rs:24:56
  24:        0x102d51a5c - pollster::block_on::h29a74a5df592e081
                               at /Users/sigmoid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pollster-0.3.0/src/lib.rs:128:15
  25:        0x102d3adac - learning_comfy::main::h670c47c9a2c03723
                               at /Users/sigmoid/.cargo/git/checkouts/comfy_touch_support-d720c83557467eae/052307e/comfy/src/macros.rs:33:17
  26:        0x102d49914 - core::ops::function::FnOnce::call_once::hfa2a15fd28174de9
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
  27:        0x102d2fdc4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3682151a095d58ce
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:155:18
  28:        0x102d33ba0 - std::rt::lang_start::{{closure}}::h36ce5440920463d9
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:166:18
  29:        0x103a1a6d4 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hde2a2ae1d756c37f
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  30:        0x103a1a6d4 - std::panicking::try::do_call::h96b73f4da16ee7c5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  31:        0x103a1a6d4 - std::panicking::try::h2cb0c14c1266f147
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  32:        0x103a1a6d4 - std::panic::catch_unwind::hb8cd2580f659030d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  33:        0x103a1a6d4 - std::rt::lang_start_internal::{{closure}}::h00f9c2d0117ea0ef
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  34:        0x103a1a6d4 - std::panicking::try::do_call::h134dfd8876bcc105
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  35:        0x103a1a6d4 - std::panicking::try::h6595e056250d6043
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  36:        0x103a1a6d4 - std::panic::catch_unwind::haad85d5172c9b53a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  37:        0x103a1a6d4 - std::rt::lang_start_internal::hf4f3eb1e51305b96
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  38:        0x102d33b6c - std::rt::lang_start::h364506377e5e4d3c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:165:17
  39:        0x102d3adf8 - _main

But the game compiles when using Comfy version 0.3.1

Thank to @darthdeus, we found that changing this line:

let surface_usage =
wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC;

To this:

let surface_usage = wgpu::TextureUsages::RENDER_ATTACHMENT;

Fixes the issue.

I'm not sure if this is an acceptable change for all users so I haven't made a pull request.

@Sigmoidle master should now have a newer version of wgpu that should fix the crash, as in the original texture usages shouldn't crash anymore. Can you check?