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

testing samples: rendering to device is not working #366

Closed
fopsdev opened this issue Aug 27, 2020 · 16 comments
Closed

testing samples: rendering to device is not working #366

fopsdev opened this issue Aug 27, 2020 · 16 comments
Labels
C-Bug An unexpected or incorrect behavior C-Dependencies A change to the crates that Bevy depends on O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash

Comments

@fopsdev
Copy link

fopsdev commented Aug 27, 2020

Hi there

I would like to run the examples and fiddle around with them.
But every example which is supposed to render something is failing.

Expected behaviour:

cargo run ---example breakout -> run breakout

Current behaviour:

window is unresponsive. and rust (and myself a bit ;)) panicks out
backtrace if its of any use:

C:\dev\test\bevy\bevy>cargo run --example breakout
    Finished dev [unoptimized + debuginfo] target(s) in 0.30s
     Running `target\debug\examples\breakout.exe`
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `-2005270523`', C:\Users\fopsd\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-dx12-0.6.2\src\device.rs:2242:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/f44c6e4e288e4f49c5c257b2e2cb2ad5918f26a3\/library\std\src\panicking.rs:475
   1: std::panicking::begin_panic_fmt
             at /rustc/f44c6e4e288e4f49c5c257b2e2cb2ad5918f26a3\/library\std\src\panicking.rs:429
   2: gfx_backend_dx12::device::{{impl}}::bind_buffer_memory
             at C:\Users\fopsd\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-dx12-0.6.2\src\device.rs:2242
   3: wgpu_core::device::Device<gfx_backend_dx12::Backend>::create_buffer<gfx_backend_dx12::Backend>
             at C:\Users\fopsd\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-core-0.6.0\src\device\mod.rs:438
   4: wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::device_create_buffer<wgpu_core::hub::IdentityManagerFactory,gfx_backend_dx12::Backend>
             at C:\Users\fopsd\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-core-0.6.0\src\device\mod.rs:969
   5: wgpu::backend::direct::{{impl}}::device_create_buffer
...
...

I'm on Win10 with a decent relatively new notebook.
It happens as well when i disconnect my external monitor

Its maybe related to: #340

DxDiag.txt

@karroffel karroffel added C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash O-Windows Specific to the Windows desktop operating system C-Dependencies A change to the crates that Bevy depends on labels Aug 27, 2020
@lee-orr
Copy link
Contributor

lee-orr commented Aug 27, 2020

I'm getting this same issue. Also on a laptop, both with and without my external monitor.

@lee-orr
Copy link
Contributor

lee-orr commented Aug 28, 2020

My issue is happening at a different line of the same file, so it may have a different cause, here's the path trace:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `-2005270523`', C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-dx12-0.6.2\src\device.rs:992:9
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\sys_common\backtrace.rs:78
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libcore\fmt\mod.rs:1076
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\io\mod.rs:1537
   5: std::sys_common::backtrace::_print
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:198
   8: std::panicking::default_hook
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:218
   9: std::panicking::rust_panic_with_hook
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:486
  10: std::panicking::begin_panic_handler
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:388
  11: std::panicking::begin_panic_fmt
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:342
  12: gfx_backend_dx12::Device::create_raw_fence
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-dx12-0.6.2\src\device.rs:992
  13: gfx_backend_dx12::device::{{impl}}::create_fence
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-dx12-0.6.2\src\device.rs:3317
  14: wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::queue_submit<wgpu_core::hub::IdentityManagerFactory,gfx_backend_dx12::Backend>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-core-0.6.0\src\device\queue.rs:562
  15: wgpu::backend::direct::{{impl}}::queue_submit<core::iter::adapters::Map<alloc::vec::Drain<wgpu::CommandBuffer>, closure-0>>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-core-0.6.0\src\lib.rs:215
  16: wgpu::Queue::submit<alloc::vec::Drain<wgpu::CommandBuffer>>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.6.0\src\lib.rs:2502
  17: bevy_wgpu::renderer::wgpu_render_graph_executor::WgpuRenderGraphExecutor::execute
             at .\crates\bevy_wgpu\src\renderer\wgpu_render_graph_executor.rs:98
  18: bevy_wgpu::wgpu_renderer::WgpuRenderer::run_graph
             at .\crates\bevy_wgpu\src\wgpu_renderer.rs:94
  19: bevy_wgpu::wgpu_renderer::WgpuRenderer::update
             at .\crates\bevy_wgpu\src\wgpu_renderer.rs:105
  20: bevy_wgpu::wgpu_render_system::{{closure}}
             at .\crates\bevy_wgpu\src\lib.rs:40
  21: bevy_ecs::system::into_system::{{impl}}::run<closure-0>
             at .\crates\bevy_ecs\src\system\into_system.rs:339
  22: bevy_ecs::system::into_system::{{impl}}::thread_local_system::{{closure}}<closure-0>
             at .\crates\bevy_ecs\src\system\into_system.rs:315
  23: bevy_ecs::system::into_system::{{impl}}::run_thread_local<(),closure-1,closure-0,closure-2,closure-3>
             at .\crates\bevy_ecs\src\system\into_system.rs:65
  24: bevy_ecs::schedule::parallel_executor::ExecutorStage::run
             at .\crates\bevy_ecs\src\schedule\parallel_executor.rs:387
  25: bevy_ecs::schedule::parallel_executor::ParallelExecutor::run
             at .\crates\bevy_ecs\src\schedule\parallel_executor.rs:57
  26: bevy_app::app::App::update
             at .\crates\bevy_app\src\app.rs:61
  27: bevy_winit::winit_runner::{{closure}}
             at .\crates\bevy_winit\src\lib.rs:212
  28: cart_tmp_winit::platform_impl::platform::event_loop::{{impl}}::run_return::{{closure}}<(),closure-1>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:202
  29: alloc::boxed::{{impl}}::call_mut<(cart_tmp_winit::event::Event<()>, mut cart_tmp_winit::event_loop::ControlFlow*),FnMut<(cart_tmp_winit::event::Event<()>, mut cart_tmp_winit::event_loop::ControlFlow*)>>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\liballoc\boxed.rs:1083
  30: cart_tmp_winit::platform_impl::platform::event_loop::runner::{{impl}}::call_event_handler::{{closure}}<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:245
  31: std::panic::{{impl}}::call_once<(),closure-0>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panic.rs:318
  32: std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,()>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panicking.rs:297
  33: cart_tmp_winit::window::{{impl}}::clone
  34: std::panicking::try<(),std::panic::AssertUnwindSafe<closure-0>>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panicking.rs:274
  35: std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,()>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panic.rs:394
  36: cart_tmp_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::catch_unwind<(),(),closure-0>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:152
  37: cart_tmp_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::call_event_handler<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:239
  38: cart_tmp_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::move_state_to<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:341
  39: cart_tmp_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::main_events_cleared<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:227
  40: cart_tmp_winit::platform_impl::platform::event_loop::flush_paint_messages<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:674
  41: cart_tmp_winit::platform_impl::platform::event_loop::thread_event_target_callback::{{closure}}<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:1959
  42: std::panic::{{impl}}::call_once<isize,closure-0>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panic.rs:318
  43: std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure-0>,isize>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panicking.rs:297
  44: cart_tmp_winit::window::{{impl}}::clone
  45: std::panicking::try<isize,std::panic::AssertUnwindSafe<closure-0>>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panicking.rs:274
  46: std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure-0>,isize>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\panic.rs:394
  47: cart_tmp_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<()>::catch_unwind<(),isize,closure-0>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop\runner.rs:152
  48: cart_tmp_winit::platform_impl::platform::event_loop::thread_event_target_callback<()>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:2142
  49: DefSubclassProc
  50: DefSubclassProc
  51: CallWindowProcW
  52: DispatchMessageW
  53: IsWindowVisible
  54: KiUserCallbackDispatcher
  55: NtUserDispatchMessage
  56: DispatchMessageW
  57: cart_tmp_winit::platform_impl::platform::event_loop::EventLoop<()>::run_return<(),closure-1>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:217
  58: cart_tmp_winit::platform_impl::platform::event_loop::EventLoop<()>::run<(),closure-1>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\platform_impl\windows\event_loop.rs:187
  59: cart_tmp_winit::event_loop::EventLoop<()>::run<(),closure-1>
             at C:\Users\leeor\.cargo\registry\src\github.com-1ecc6299db9ec823\cart-tmp-winit-0.22.2\src\event_loop.rs:149
  60: bevy_winit::run<closure-1>
             at .\crates\bevy_winit\src\lib.rs:42
  61: bevy_winit::winit_runner
             at .\crates\bevy_winit\src\lib.rs:220
  62: core::ops::function::Fn::call<fn(bevy_app::app::App),(bevy_app::app::App)>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libcore\ops\function.rs:72
  63: alloc::boxed::{{impl}}::call<(bevy_app::app::App),Fn<(bevy_app::app::App)>>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\liballoc\boxed.rs:1090
  64: bevy_app::app::App::run
             at .\crates\bevy_app\src\app.rs:74
  65: bevy_app::app_builder::AppBuilder::run
             at .\crates\bevy_app\src\app_builder.rs:43
  66: sprite::main
             at .\examples\2d\sprite.rs:4
  67: std::rt::lang_start::{{closure}}<()>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\rt.rs:67
  68: std::rt::lang_start_internal::{{closure}}
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\rt.rs:52
  69: std::panicking::try::do_call
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:297
  70: std::panicking::try
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panicking.rs:274
  71: std::panic::catch_unwind
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\panic.rs:394
  72: std::rt::lang_start_internal
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\/src\libstd\rt.rs:51
  73: std::rt::lang_start<()>
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54\src\libstd\rt.rs:67
  74: main
  75: invoke_main
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  76: __scrt_common_main_seh
             at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  77: BaseThreadInitThunk
  78: RtlUserThreadStart

@lee-orr
Copy link
Contributor

lee-orr commented Aug 28, 2020

I do have both an intel & an amd GPU on this laptop, in case that's relevant.

@fopsdev
Copy link
Author

fopsdev commented Aug 28, 2020

Same on my machine
Intel UHD 620
Amd 500 series
More Details in the attached DXDiag-File

@fopsdev
Copy link
Author

fopsdev commented Aug 29, 2020

still the same after cargo update
would be great if somebody more experienced (doens't take too much) would chime in here.

sidenote: the wgpu-rs samples are working

@fopsdev
Copy link
Author

fopsdev commented Aug 29, 2020

Also would be great to know how to force wgpu to use vulkan instead of directx
Or how to force to use a specific adapter

@utherpally
Copy link

utherpally commented Aug 30, 2020

I have the same issue, when I reset to db8ec7d, the issue disappears. So the problem is probably from #384.

updated: Tested on Linux too, window is unresponsive, but don't crash. Should I create a another issues?

@fopsdev
Copy link
Author

fopsdev commented Aug 30, 2020

thanks to some help in discord @MGlolenstine adviced me to revert c42dad5
after that it uses the primary gpu (intel uhd620) and the examples work
so it seems to be a issue with the radeon 500 series which is built into my laptop
i will retry the wgpu-rs samples forcing to use the radeon and i'll leave an issue there if the error is reproducable there

@Dispersia
Copy link
Contributor

Dispersia commented Aug 30, 2020

@fopsdev you shouldn't have to revert that, looking up both your integrated and dedicated graphics, your radeon has better support for DX12 than your uhd620. Have you tried updating your drivers, and have you tried other dx12 software on that computer? (also since its a laptop i assume prebuilt, can you link your computer?)

also, doesn't look like bevy exposes the feature flags for wgpu, but you should be able to add them to bevy_wgpu, then do the main bevy crate to try vulkan or whatever.

@lee-orr
Copy link
Contributor

lee-orr commented Aug 30, 2020

@Dispersia - In theory, the same is true for my laptop. However, it still crashes when I try to use my radeon. The problem seems to be in wgpu - even the wgpu-rs examples fail if I attempt to have it use the Radeon graphics card.
I'll try to expose the vulkan/dx12/etc flags from wgpu through bevy, and see if that makes a difference. If it does, I'll adjust my PR.

@Dispersia
Copy link
Contributor

have you tried updating drivers as well? also would still like a link to the laptop, to see default driver versions

@MGlolenstine
Copy link
Contributor

@Dispersia, MGlolenstine here. I've advised on reverting the commit because of problems with driver installation. I'm assuming that either Windows10, MOBO's chipset or wgpu code are causing problems. Problems could be solved by installing chipset drivers or somehow tricking GPU drivers to install correctly. It could also be something that we haven't thought of yet.

wgpu works fine on my RX 580(desktop gpu), so it has to do something with a laptop.

@lee-orr does your computer use the same Intel + AMD combo?

@lee-orr
Copy link
Contributor

lee-orr commented Aug 30, 2020

Different one - mine is a Radeon RX Vega M GL card (embedded on the die w/ the intel CPU). These ones haven't had a driver update in a while, even though they are only a couple years old.
But I was experiencing the same issue, and the same solution worked for me.

@fopsdev
Copy link
Author

fopsdev commented Aug 31, 2020

Hi there
Important note:
In my case the wgpu-rs samples are running with the HighPerformance Setting (thus using the radeon gpu) but not in bevy.
I was trying to replace the part where an adapter instance gets created in bevy:
crates\bevy_wgpu\src\wgpu_renderer.rs

        let adapter = instance
            .request_adapter(&wgpu::RequestAdapterOptions {
                power_preference: wgpu::PowerPreference::HighPerformance,
                compatible_surface: None,
            })
            .await
            .unwrap();

with the one from wgpu-rs

    let adapter = instance
        .request_adapter(&wgpu::RequestAdapterOptions {
            power_preference: wgpu::PowerPreference::HighPerformance,
            compatible_surface: Some(&surface),
        })
        .await
        .unwrap();

but the difference is that wgpu-rs uses a initialised surface which is missing in bevy

Update

Ok false alarm regarding surface
If i use
compatible_surface: None as it is in bevy inside wgpu-rs it still works...
So there is something fishy further down the line...

@fopsdev
Copy link
Author

fopsdev commented Sep 6, 2020

@Dispersia
forgot to come back to your "have you update your driver..." question and i think its important that you know #402 which implies that this shouldn't be a driver/environment issue

@Dispersia
Copy link
Contributor

It is still most likely a driver issue. GPUs have features they add in their drivers, and bevy is probably using something your driver is falsely reporting as working, while the base examples are not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior C-Dependencies A change to the crates that Bevy depends on O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

6 participants