dx12: Stricter allocator reset#2667
Conversation
|
I'm a bit confused. If each command buffer comes with an allocator, why do we still suffer from the reset() in wgpu?
|
|
Ok, I think I see what's happening now. The allocator is still shared between command buffers, but since we didn't call The proper solution would be one (or both) of the two:
bors r+ |
2667: dx12: Stricter allocator reset r=kvark a=msiglreith Adjust reset behavior for associated allocator for individual command lists. `quad` example runs fine (as expected). wgpu examples will crash due to resetting the allocator while concurrent recording. Co-authored-by: msiglreith <m.siglreith@gmail.com>
|
While this needs to be ported to hal-0.1 at some point, this is not going to improve the situation with wgpu-rs. So I think we need to fix wgpu-rs first, and then think about back-porting this. |
|
Important note: what this is solving is resource leaks in case of simple applications. It's less forgiving for the others (turning warnings into crashes). We'll need a proper solution for DX12 backend regardless, at which point this PR will be reconsidered and/or reverted. |
Build succeeded |
right, there are actually 2 different issues depending on what is used and I mixed those up :D
Command Buffer LifecyclesCommandList::Reset in dx12 has a reset+begin semantic for commands buffers (-> Recording state), in Vulkan Reset means setting it back into Initial State and begin we can move from Initial to Recording, but Begin also can have a reset semantic when individual reset is allowed. Back to the issue, reset + begin in vulkan works fine (cur state -> Initial -> Recording), transferring this into dx12 would mean (cur state -> recording -> recording!), which is not legal) |
|
Thanks for clarifying! So we do have dedicated command allocators for the command buffers that are individually reset?
Sounds like we are missing just a few bits then (what you said to be the state tracking):
|
Adjust reset behavior for associated allocator for individual command lists.
quadexample runs fine (as expected).wgpu examples will crash due to resetting the allocator while concurrent recording.