Description
Panics at https://github.com/retep998/wio-rs/blob/9bf021178b2d02485f1bd35e6cff41bf52d4a9a2/src/com.rs#L34 when calling submit_queue. This occurs when running veloren with the dx11 backend after clicking to enter the world from the character selection screen. This isn't a pressing issue and I haven't fully invesitgated it yet, but I figured I should go ahead and report it 馃檪. Also, I need to fix another issue in the dx11 backend before I can have a reproduceable example for others to test.
Repro steps
TODO (need to fix https://github.com/gfx-rs/gfx/issues/3711 first)
Expected vs observed behavior
No panic vs panic
Extra materials
panicked at 'ptr should not be null', ~\.cargo\registry\src\github.com-1ecc6299db9ec823\wio-0.2.2\src\com.rs:21:34
Backtrace:
0: backtrace::backtrace::trace
1: backtrace::capture::Backtrace::new
2: tracing_core::event::Event::metadata
3: std::panicking::rust_panic_with_hook
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\std\src\panicking.rs:595
4: std::panicking::begin_panic_handler::{{closure}}
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\std\src\panicking.rs:497
5: std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\std\src\sys_common\backtrace.rs:141
6: std::panicking::begin_panic_handler
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\std\src\panicking.rs:493
7: core::panicking::panic_fmt
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\core\src\panicking.rs:92
8: core::option::expect_failed
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\core\src\option.rs:1260
9: <gfx_backend_dx11::CommandBuffer as gfx_hal::command::CommandBuffer<gfx_backend_dx11::Backend>>::fill_buffer
10: wgpu_core::device::queue::<impl wgpu_core::hub::Global<G>>::queue_submit
11: <wgpu::backend::direct::Context as wgpu::Context>::queue_submit
12: <veloren_voxygen::render::renderer::drawer::Drawer as core::ops::drop::Drop>::drop
13: core::ptr::drop_in_place
14: <veloren_voxygen::session::SessionState as veloren_voxygen::PlayState>::render
Platform
gfx-hal version: d002952 (with local modifications to avoid https://github.com/gfx-rs/gfx/issues/3711)wgpu-rs version: d44fc6ff855faf37b63fd711a9f9a916256cedc2Compiled with debug info for a more detailed backtrace:
11: core::option::expect_failed
at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\core\src\option.rs:1260
12: gfx_backend_dx11::{{impl}}::fill_buffer
at veloren\gfx\src\backend\dx11\src\lib.rs:2837
13: wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::initialize_used_uninitialized_memory
at checkouts\wgpu-53e70f8674b08dd4\41f106d\wgpu-core\src\device\queue.rs:602
14: wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>::queue_submit<wgpu_core::hub::IdentityManagerFactory,gfx_backend_dx11::Backend>
at checkouts\wgpu-53e70f8674b08dd4\41f106d\wgpu-core\src\device\queue.rs:624
15: wgpu::backend::direct::{{impl}}::queue_submit<core::iter::adapters::map::Map<core::iter::sources::once::Once<wgpu::CommandBuffer>, closure-0>>
at checkouts\wgpu-rs-40ea39809c03c5d8\d44fc6f\src\backend\direct.rs:1837
16: wgpu::Queue::submit
at checkouts\wgpu-rs-40ea39809c03c5d8\d44fc6f\src\lib.rs:2842
17: veloren_voxygen::render::renderer::drawer::{{impl}}::drop
I've tracked it down to a E_INVALIDARG (0x80070057) from CreateUnorderedAccessView here: https://github.com/gfx-rs/gfx/blob/99e75efbe6ca95c2ad3eecf49cfb8474a17050df/src/backend/dx11/src/lib.rs#L2824
some debug prints (not sure if there's any useful info here)
this one failed:
buffer = Buffer {
internal: InternalBuffer {
raw: 0x00000279422ac570,
disjoint_cb: None,
srv: None,
uav: Some(
0x000002794f4c4d30,
),
usage: TRANSFER_DST | VERTEX,
debug_name: None,
},
is_coherent: false,
memory_ptr: 0x0000000000000000,
bound_range: 5701632..5760416,
local_memory_arena: (Weak),
memory_index: Some(
Index {
slot: 480,
generation: Generation(
2,
),
},
),
requirements: Requirements {
size: 58784,
alignment: 4,
type_mask: 5,
},
bind: 129,
}
&sub = SubRange {
offset: 44088,
size: Some(
14696,
),
}
sub.offset as u32 / 4 = 11022
sub.size.unwrap_or(buffer.requirements.size) as u32 / 4 = 3674
example of one that succeeded:
buffer = Buffer {
internal: InternalBuffer {
raw: 0x000002794b675130,
disjoint_cb: None,
srv: None,
uav: Some(
0x000002794c1892a0,
),
usage: TRANSFER_DST | VERTEX,
debug_name: None,
},
is_coherent: false,
memory_ptr: 0x0000000000000000,
bound_range: 55050240..55248768,
local_memory_arena: (Weak),
memory_index: Some(
Index {
slot: 0,
generation: Generation(
1,
),
},
),
requirements: Requirements {
size: 198528,
alignment: 4,
type_mask: 5,
},
bind: 129,
}
&sub = SubRange {
offset: 148896,
size: Some(
49632,
),
}
sub.offset as u32 / 4 = 37224
sub.size.unwrap_or(buffer.requirements.size) as u32 / 4 = 12408
Running in VS gives:
D3D11 ERROR: ID3D11Device::CreateUnorderedAccessView: When creating a RAW Shader Resource View, the offset of the first element from the start of the buffer must be a multiple of 16 bytes. Thus, FirstElement (37290) must be a multiple of 4 since each element is 4 bytes. [ STATE_CREATION ERROR #2097344: CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS]
Great investigation, thank you!
Created https://github.com/gfx-rs/gfx/issues/3718 to follow-up