Depth buffer creation fails
Closed this issue · 7 comments
Hello! I am working on a renderer.
Execution fails in this function on wgpu::Device::create_texture
:
fn create_depth_buffer(device: &wgpu::Device, width: u32, height: u32) -> wgpu::TextureView {
let buffer_extent = wgpu::Extent3d {
width: width,
height: height,
depth: 1,
};
let draw_depth_buffer = device.create_texture(&wgpu::TextureDescriptor {
label: Some("Depth Buffer"),
size: buffer_extent,
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Depth32Float,
usage: wgpu::TextureUsage::SAMPLED
| wgpu::TextureUsage::COPY_DST
| wgpu::TextureUsage::RENDER_ATTACHMENT,
});
draw_depth_buffer.create_view(&wgpu::TextureViewDescriptor::default())
}
Full traceback is here:
D:\_projects\lowenware\dotrix>cargo run --release --example demo
Finished release [optimized] target(s) in 0.63s
Running `target\release\examples\demo.exe`
Starting Input Example
thread 'main' panicked at 'internal error: entered unreachable code', C:\Users\Nik\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-vulkan-0.6.5\src\device.rs:1527:18
stack backtrace:
0: 0x7ff7f353a3d9 - std::backtrace_rs::backtrace::dbghelp::trace
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
1: 0x7ff7f353a3d9 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff7f353a3d9 - std::sys_common::backtrace::_print_fmt
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:79
3: 0x7ff7f353a3d9 - std::sys_common::backtrace::_print::{{impl}}::fmt
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:58
4: 0x7ff7f355030b - core::fmt::write
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\core\src\fmt\mod.rs:1082
5: 0x7ff7f3537064 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\io\mod.rs:1514
6: 0x7ff7f353d47b - std::sys_common::backtrace::_print
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:61
7: 0x7ff7f353d47b - std::sys_common::backtrace::print
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:48
8: 0x7ff7f353d47b - std::panicking::default_hook::{{closure}}
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:200
9: 0x7ff7f353d0b9 - std::panicking::default_hook
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:219
10: 0x7ff7f353dc5f - std::panicking::rust_panic_with_hook
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:569
11: 0x7ff7f34a87c4 - std::panicking::begin_panic::h93ca6b45cb335126
12: 0x7ff7f34a875f - <std::sys_common::poison::PoisonError<T> as core::fmt::Debug>::fmt::h6ad3f8f33846da87
13: 0x7ff7f34a879d - std::panicking::begin_panic::h93ca6b45cb335126
14: 0x7ff7f349dcae - gfx_backend_vulkan::device::<impl gfx_hal::device::Device<gfx_backend_vulkan::Backend> for gfx_backend_vulkan::Device>::bind_image_memory::hae56465101934a69
15: 0x7ff7f335f346 - wgpu_core::device::Device<B>::create_texture::hc078c38c92f56398
16: 0x7ff7f32b30e2 - wgpu_core::device::<impl wgpu_core::hub::Global<G>>::device_create_texture::h5f90aeef95887a46
17: 0x7ff7f3204676 - <wgpu::backend::direct::Context as wgpu::Context>::device_create_texture::hf78ddd1cba4044ce
18: 0x7ff7f31d98e5 - wgpu::Device::create_texture::h271ebae84bad6fc2
19: 0x7ff7f307ba17 - dotrix::renderer::Renderer::create_depth_buffer::h0b0aef5f9a1b9c23
20: 0x7ff7f3086187 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0d5900b0d2106419
21: 0x7ff7f30769d9 - std::thread::local::LocalKey<T>::with::h118cbc81dc8c9542
22: 0x7ff7f308ac17 - futures_executor::local_pool::block_on::h70f03aadd2bcb00d
23: 0x7ff7f3095f8f - dotrix::application::Application::run::hd72b544d8fe1abb8
24: 0x7ff7f307415f - dotrix::Dotrix::run::hb1cfdbfef3f74dfc
25: 0x7ff7f301c67e - <std::sys_common::poison::PoisonError<T> as core::fmt::Debug>::fmt::hcb67d202ec8bbdc1
26: 0x7ff7f301a966 - std::sys_common::backtrace::__rust_begin_short_backtrace::h293b0089a2f5a2e1
27: 0x7ff7f306606c - std::rt::lang_start::{{closure}}::h1f4686c8856ab9e5
28: 0x7ff7f353df76 - core::ops::function::impls::{{impl}}::call_once
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\library\core\src\ops\function.rs:280
29: 0x7ff7f353df76 - std::panicking::try::do_call
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:373
30: 0x7ff7f353df76 - std::panicking::try
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:337
31: 0x7ff7f353df76 - std::panic::catch_unwind
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panic.rs:379
32: 0x7ff7f353df76 - std::rt::lang_start_internal
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\rt.rs:51
33: 0x7ff7f301cc17 - main
34: 0x7ff7f3896424 - invoke_main
at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
35: 0x7ff7f3896424 - __scrt_common_main_seh
at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
36: 0x7ffea1387c24 - BaseThreadInitThunk
37: 0x7ffea26cd4d1 - RtlUserThreadStart
Memory block wasn't deallocated
error: process didn't exit successfully: `target\release\examples\demo.exe` (exit code: 101)
It happens only on Windows 10. On MacOS everthing works as expected.
The full code is here: lowenware/dotrix you can run the example with RUST_BACKTRACE=1 cargo run --release --example demo
Is that wgpu issue or I did something wrong?
EDIT:
I believe it is on WGPU side. The water
example fails to start too on Win 10:
D:\_projects\learning\GameDev\wgpu>set RUST_BACKTRACE=full
D:\_projects\learning\GameDev\wgpu>cargo run --release --example water
Finished release [optimized] target(s) in 0.69s
Running `target\release\examples\water.exe`
thread 'main' panicked at 'internal error: entered unreachable code', C:\Users\Nik\.cargo\registry\src\github.com-1ecc6299db9ec823\gfx-backend-vulkan-0.6.5\src\device.rs:1527:18
stack backtrace:
0: 0x7ff64abb0d49 - std::backtrace_rs::backtrace::dbghelp::trace
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
1: 0x7ff64abb0d49 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff64abb0d49 - std::sys_common::backtrace::_print_fmt
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:79
3: 0x7ff64abb0d49 - std::sys_common::backtrace::_print::{{impl}}::fmt
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:58
4: 0x7ff64abc756b - core::fmt::write
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\core\src\fmt\mod.rs:1082
5: 0x7ff64abadea4 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\io\mod.rs:1514
6: 0x7ff64abb3deb - std::sys_common::backtrace::_print
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:61
7: 0x7ff64abb3deb - std::sys_common::backtrace::print
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\sys_common\backtrace.rs:48
8: 0x7ff64abb3deb - std::panicking::default_hook::{{closure}}
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:200
9: 0x7ff64abb3a29 - std::panicking::default_hook
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:219
10: 0x7ff64abb45cf - std::panicking::rust_panic_with_hook
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:569
11: 0x7ff64ab22e24 - std::panicking::begin_panic::h93ca6b45cb335126
12: 0x7ff64ab22dbf - <std::sys_common::poison::PoisonError<T> as core::fmt::Debug>::fmt::h6ad3f8f33846da87
13: 0x7ff64ab22dfd - std::panicking::begin_panic::h93ca6b45cb335126
14: 0x7ff64ab17cbe - gfx_backend_vulkan::device::<impl gfx_hal::device::Device<gfx_backend_vulkan::Backend> for gfx_backend_vulkan::Device>::bind_image_memory::hae56465101934a69
15: 0x7ff64a9f42b6 - wgpu_core::device::Device<B>::create_texture::ha11d01a9fd413064
16: 0x7ff64a943392 - wgpu_core::device::<impl wgpu_core::hub::Global<G>>::device_create_texture::hb66fd6f1e004e21b
17: 0x7ff64a8aa0e6 - <wgpu::backend::direct::Context as wgpu::Context>::device_create_texture::ha92bef6644c6ca6a
18: 0x7ff64a86b915 - wgpu::Device::create_texture::hc672149d941b0237
19: 0x7ff64a72167b - <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::ha5746758a941f146
20: 0x7ff64a722430 - <water::Example as water::framework::Example>::init::h085eb98bc4095b63
21: 0x7ff64a73fe07 - water::framework::start::hf5ea7b733aa91b9b
22: 0x7ff64a74018e - water::framework::run::h13f5b8de48317634
23: 0x7ff64a724745 - <water::Example as water::framework::Example>::render::hc86eb43134f74924
24: 0x7ff64a7252a6 - std::sys_common::backtrace::__rust_begin_short_backtrace::he805fb782ce7c799
25: 0x7ff64a73625c - std::rt::lang_start::{{closure}}::hbbb7309bead68635
26: 0x7ff64abb48e6 - core::ops::function::impls::{{impl}}::call_once
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\library\core\src\ops\function.rs:280
27: 0x7ff64abb48e6 - std::panicking::try::do_call
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:373
28: 0x7ff64abb48e6 - std::panicking::try
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panicking.rs:337
29: 0x7ff64abb48e6 - std::panic::catch_unwind
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\panic.rs:379
30: 0x7ff64abb48e6 - std::rt::lang_start_internal
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\/library\std\src\rt.rs:51
31: 0x7ff64a724777 - main
32: 0x7ff64ac7dcb0 - invoke_main
at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
33: 0x7ff64ac7dcb0 - __scrt_common_main_seh
at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
34: 0x7ffea1387c24 - BaseThreadInitThunk
35: 0x7ffea26cd4d1 - RtlUserThreadStart
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
Memory block wasn't deallocated
error: process didn't exit successfully: `target\release\examples\water.exe` (exit code: 101)
Thank you for filing! is this on wgpu-0.6? or on master?
There is a few links to check wrt debugging:
- https://github.com/gfx-rs/wgpu/wiki/Debugging-wgpu-Applications
- https://github.com/gfx-rs/gfx/wiki/Debugging-D3D
I'm going to look at it ASAP. In the meantime, if you run the app from Visual Studio, you should see in the output console what D3D validation error is with regards to this operation.
Ok, in this case, there is a chance we are seeing zakarumych/gpu-alloc#24
Migration to gpu-alloc happened recently, and it's not tested, and very young.
I'm going to look closer at the issue tonight.
For the record, I double-checked the water example on latest wgpu-rs on Win10 with Intel GPU, and it runs without issues.
Could you log the adapter.get_info()
output somewhere?
Ok, I'm not able to reproduce this so far. Please provide the adapter info as well as the output of the test case ran from Visual Studio. This should be easy to fix.
Unable to reproduce on AMD/Windows/Vulkan either
Hello @kvark, sorry for the late response. I have just pulled the latest changes from master and now everything seems to be working (probably the issue can be closed).
Just in case, I am sending the info about my GPU as requested above:
My adapter: AdapterInfo { name: "GeForce GT 650M", vendor: 4318, device: 4049, device_type: DiscreteGpu, backend: Vulkan }