-
Notifications
You must be signed in to change notification settings - Fork 105
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
v22.1.0.1 crashes on wgpuQueueSubmit()
if wgpuRenderPassEncoderRelease()
wasn't called.
#412
Comments
Yeah in previous versions it was incorrectly allowed to release the |
How could that be part of the spec? In JavaScript, I didn't think it was possible to manually release a RenderPass. |
|
Where are things like this RenderPass lifetime rule specified? My understanding was that the JS API and the C API should be implementable on top of each other. I don't see how the JS API could be implemented on top of the C API with this lifetime rule. |
Seem like this is similar to gfx-rs/wgpu#6145. |
Yes, this is exactly the same. The extra scope for the render pass shown there serves as a workaround for a ref-counted language (including C++ with RAII). I guess a similar workaround for a garbage collected language could be to add the scope and manually triggering the garbage collector immediately after closing the scope. I hope this can be fixed and these workarounds avoided. |
I also run into this in pygfx/wgpu-py#547 and just made the private I am not sure if there is any case where a end call is not followed by release. So it feels somewhat redundant |
I have just run into this myself, and I must say the error message and fix was not at all intuitive. Is there something I can refer to to understand the lifetime expectations and refcount rules for these objects in C/C++? |
My understanding is that this is a deviation from the spec. |
Just spent a couple of hours debugging this myself. Someday I will learn to check github issues first :)
@rajveermalviya but surely the crash with an unrelated error message cannot be a desired behavior? I'm not arguing for that to be the only correct way of handling resources, but e.g. dawn doesn't crash and (seems to) release encoder passes by itself. |
I just updated to wgpu-native v22.1.0.1. If I don't call
wgpuRenderPassEncoderRelease()
beforewgpuQueueSubmit()
, I get an error:The code looks like this:
The relevant part of the backtrace:
Here is a runnable fairly minimal crashing example: https://github.com/yig/LearnWebGPU-Code/blob/step030-vanilla/main.cpp#L233
I hacked the
CMakeLists.txt
to run on macos-aarch64. (It hard-codes themacos-aarch64
release and adds-framework Metal
linker flags. Otherwise, it should be easy to modify to reproduce on other platforms.)The text was updated successfully, but these errors were encountered: