Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panicked on wgpuSurfaceGetPreferredFormat on MacOS #399

Open
matthewperiut opened this issue Jul 4, 2024 · 0 comments
Open

Panicked on wgpuSurfaceGetPreferredFormat on MacOS #399

matthewperiut opened this issue Jul 4, 2024 · 0 comments

Comments

@matthewperiut
Copy link

Tested on two macs, Intel Xeon cpu w/ rx 6900 xt, and M1 Pro cpu/gpu.

Logs:
non-verbose

thread '<unnamed>' panicked at src/lib.rs:3831:22:
Identifier refers to disabled backend feature "empty"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

verbose

matthewperiut@Matthews-Mac-Pro cmake-build-debug % ./learnwebgpu             
Requesting adapter...
Got adapter: 0x600002699910
Requesting device...
Got device: 0x6000006959c0
thread '<unnamed>' panicked at src/lib.rs:3831:22:
Identifier refers to disabled backend feature "empty"
stack backtrace:
   0:        0x1025293e5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h46bc8e86d021398c
   1:        0x102547313 - core::fmt::write::h1c24e945c7ef8357
   2:        0x10252773e - std::io::Write::write_fmt::hd9fe01a40900d808
   3:        0x1025291b9 - std::sys_common::backtrace::print::hdbfcabb7d363540a
   4:        0x10252a425 - std::panicking::default_hook::{{closure}}::hecb24382dfeeea98
   5:        0x10252a19e - std::panicking::default_hook::h78dca947ab9e89eb
   6:        0x10252a893 - std::panicking::rust_panic_with_hook::hb83cee65df04957a
   7:        0x10252a7a4 - std::panicking::begin_panic_handler::{{closure}}::hbe6e44d88f82bc77
   8:        0x1025298d9 - std::sys_common::backtrace::__rust_end_short_backtrace::h6560cb9c1f1224c1
   9:        0x10252a4e6 - _rust_begin_unwind
  10:        0x102572ca5 - core::panicking::panic_fmt::h2aac8cf45f7ae617
  11:        0x1022b016a - _wgpuSurfaceGetPreferredFormat
  12:        0x101796375 - _ZN11Application10InitializeEv
                               at /Users/matthewperiut/CLionProjects/learnwebgpu/main.cpp:134:36
  13:        0x101796078 - main
                               at /Users/matthewperiut/CLionProjects/learnwebgpu/main.cpp:46:11
  14:     0x7ff818f6d366 - <unknown>
fatal runtime error: failed to initiate panic, error 5
zsh: abort      ./learnwebgpu

Reported C++ that is causing the panic:
WGPUTextureFormat surfaceFormat = wgpuSurfaceGetPreferredFormat(surface, adapter);

Output when the line is changed to
WGPUTextureFormat surfaceFormat = WGPUTextureFormat_RGBA8Uint;
Noted because on #393 which is very similar, someone commented "It looks like wgpu reports that the surface simply has zero supported formats" and this prints the other formats:

thread '<unnamed>' panicked at src/lib.rs:586:5:
Error in wgpuSurfaceConfigure: Validation Error

Caused by:
    Requested format Rgba8Uint is not in list of supported formats: [Bgra8Unorm, Bgra8UnormSrgb, Rgba16Float, Rgb10a2Unorm]

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

So then using a supported format, Rgba16Float (on the rx 6900 xt on macos)
WGPUTextureFormat surfaceFormat = WGPUTextureFormat_RGBA16Float;

image
works great!

So the issue is just with wgpuSurfaceGetPreferredFormat itself.
Additionally the same code under dawn works fine using wgpuSurfaceGetPreferredFormat.

Thanks all here for working on wgpu-native.

Additionally, I may be doing something incorrectly on my end, I apologize if so and would appreciate feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant