-
Notifications
You must be signed in to change notification settings - Fork 930
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
[hal/vk] Rework Submission and Surface Synchronization #5681
[hal/vk] Rework Submission and Surface Synchronization #5681
Conversation
Works fine for me running the cube example with VK validation layers enabled
|
This fixes an annoying access violation termination (that I thought was a driver bug) on program exit after a present. |
Unfortunately, it does not fix #5644 for me. Same constant validation error on presentation:
The actual validation error only happens with a Flamegraph of For comparison, same drivers with Even if I enable |
@hecrj could you try again with these latest commits, someone else who can reproduce the validation error says that this fixed it. |
ea6e6ba
to
329513b
Compare
@cwfitzgerald Yep! The latest changes fix the validation errors. Thanks! I'm still noticing a bit of worse performance in |
I'm actually rewriting these comments as I review so if you're not attached to them then don't worry too much about fixing anything. |
Yeah that's fine - I was just trying to get something there. |
@cwfitzgerald What do you think of this? da543fb51 My hope was that this would make the states of [edit: made this a little nicer still: |
@cwfitzgerald Here's an even more radical suggestion: b5d52fe Just use a single semaphore for all queue ordering. |
@jimblandy i think we can go for it, the only question is if we want to still avoid this deadlock in anv mentioned in the old code, it if we consider that old enough to ignore.
I should have perseved that comment somehow. |
Ahh, yes, I was reviewing by checking out the branch and just wandering around with rust-analyzer, so I didn't notice that the patch removed the comment. If that's the sole rationale for the entire semaphore-swapping doohickey then we had definitely better have the comment. Kvark filed that bug in Oct 2021. That's not that long ago, so I think we'd better keep it. It sounds like a bear to debug, and I'd rather not have to debug it again. |
So I guess the remaining question is what you think of this one. |
So here's the latest version of my suggestion: |
Introduce a utility function for making binary semaphores, and use it where appropriate.
This allows us to delete `should_wait`, and makes `RelaySemaphoreState` the same as `RelaySemaphores`, so we can just delete the former, and have `RelaySemaphores::advance` return a clone of `self`'s current state.
a5a000c
to
4cf108c
Compare
0.20 has a bunch of bugs that will be fixed by: * gfx-rs/wgpu#5681 At Rerun, we don't want to wait for the wgpu 0.20.1 patch release before we update egui, so we will temporarily downgrade to wgpu 0.19 After reverting I'll open a new PR that will update to 0.20 again, with the intention of merging that once 0.20.1 is released.
0.20 has a bunch of bugs that will be fixed by: * gfx-rs/wgpu#5681 At Rerun, we don't want to wait for the wgpu 0.20.1 patch release before we update egui, so we will temporarily downgrade to wgpu 0.19 After reverting I'll open a new PR that will update to 0.20 again, with the intention of merging that once 0.20.1 is released.
Fix two major synchronization issues in `wgpu_val::vulkan`: - Properly order queue command buffer submissions. Due to Mesa bugs, two semaphores are required even though the Vulkan spec says that only one should be necessary. - Properly manage surface texture acquisition and presentation: - Acquiring a surface texture can return while the presentation engine is still displaying the texture. Applications must wait for a semaphore to be signaled before using the acquired texture. - Presenting a surface texture requires a semaphore to ensure that drawing is complete before presentation occurs. Co-authored-by: Jim Blandy <[email protected]>
* this PR reverts #4559 * and re-applies #4433 Before we merge, we're waiting for a wgpu 0.20.1 patch-release of * gfx-rs/wgpu#5681 --------- Co-authored-by: Andreas Reich <[email protected]>
Fix two major synchronization issues in `wgpu_val::vulkan`: - Properly order queue command buffer submissions. Due to Mesa bugs, two semaphores are required even though the Vulkan spec says that only one should be necessary. - Properly manage surface texture acquisition and presentation: - Acquiring a surface texture can return while the presentation engine is still displaying the texture. Applications must wait for a semaphore to be signaled before using the acquired texture. - Presenting a surface texture requires a semaphore to ensure that drawing is complete before presentation occurs. Co-authored-by: Jim Blandy <[email protected]>
0.20 has a bunch of bugs that will be fixed by: * gfx-rs/wgpu#5681 At Rerun, we don't want to wait for the wgpu 0.20.1 patch release before we update egui, so we will temporarily downgrade to wgpu 0.19 After reverting I'll open a new PR that will update to 0.20 again, with the intention of merging that once 0.20.1 is released.
* this PR reverts emilk#4559 * and re-applies emilk#4433 Before we merge, we're waiting for a wgpu 0.20.1 patch-release of * gfx-rs/wgpu#5681 --------- Co-authored-by: Andreas Reich <[email protected]>
Connections
Description
As described in #5559, our submission and surface synchronization was totally messed up. I've revamped it, made smarter classes to help keep all the bookkeeping straight, and generally make the code cleaner and easier to understand.
Testing
works on my machine lel