-
Notifications
You must be signed in to change notification settings - Fork 968
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
Add check to ensure vulkan::CommandEncoder::discard_encoding
is not called multiple times in a row
#5557
Add check to ensure vulkan::CommandEncoder::discard_encoding
is not called multiple times in a row
#5557
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, going to flag Erich on this one
I'm actually -0.5 on this PR. The idea is for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having thought about this more, I'd like to put a temporary pause on this PR.
At least given my understanding of the role wgpu's core/hal distinction is supposed to play in keeping wgpu maintainable, adding obligations that wgpu-hal
trait implementors must meet to make life easier for their users is putting the code in the wrong place. State tracking, validation, and resource management should be handled in common code within wgpu-core
, not repeated in each wgpu_hal
backend.
@villuna, apologies for the back-and-forth - there's nothing wrong with the code at all, and it looks like it correctly implements the intended change. I just want a day or so for the maintainers to talk things over and get a shared understanding.
For what it's worth, I've been looking into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like we've got some consensus around #5566, so in that context:
Thanks for the comments, I've made the changes you requested. I've also removed the drop implementation, since it was calling discard_encoding twice and triggering the assert panic 😅. I guess it's working |
wgpu_hal::vulkan::CommandEncoder::discard_encoding
idempotent and implement Drop for the encoder.vulkan::CommandEncoder::discard_encoding
is not called multiple times in a row
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I did some minor copy-editing.
Superseded by subsequent reviews.
Connections
Addresses #5255
Description
I just followed the (very helpful) todo list in Erich's issue, so the info is mostly there.
The vulkan implementation for
CommandEncoder
was previously pushing its active CommandBuffer handle to its discard vector every time thediscard_encoding
function was called, even if the handle was null. So I made it only do this if the active handle is non-null, so as to make the function idempotent.Testing
No new tests but I ran the existing test suite on Vulkan (on an Nvidia GTX1050) and it ran the same as on the trunk branch.
Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests - I got one error every now and then, but this also happened on the main branch so I think it's fine.CHANGELOG.md
. See simple instructions inside file.