-
Notifications
You must be signed in to change notification settings - Fork 963
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
Prevent Metal from crashing when a still-open encoder is deallocated, resolve issue #2077. #4023
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.
This change makes sense to me; I think the shape of it might change a bit, but using Drop
to implment this seems like an elegant way to solve the problem.
If it weren't for the CHANGELOG
entry, I'd "only" be leaving a Comment
review, not a Request changes
review.
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.
Does this PR fix #2077 and particularly the repro case I described in #2077 (comment) ?
If so, it should be mentioned in the PR description.
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.
This needs a test case, probably in tests/tests/encoder.rs
.
As long as the fix is in Perhaps the right place to document this requirement is in |
@jimblandy: I'm confused. Why are we talking about |
Sorry - Brad had shown me an earlier version of this patch that addressed the problem in generic code. This PR is completely different from that. This is indeed a Metal-only fix. |
It seems like wgpu-hal's Vulkan backend doesn't have any similar requirement: But it's a little hard to follow, which is one reason I'd like to have a test case in this PR that runs on all platforms but reproduces the problem on Metal. |
CommandEncoder such that we can call the existing discard_encoding function. Also add a test of dropping a CommandEncoder after it has errored on a command.
From the failures in the attempted merge, it appears that DX12 is failing the new test and therefore needs a similar intervention. The DX12 error is |
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.
LGTM after nit
D3D12 isn't happy with this change, unfortunately:
|
Since all the superclass implementations were empty, I just re-implemented it for DX12. |
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.
LGTM, minus Connor's concern.
I'm not confident I'll be able to resolve the DX12 test failure with my setup in a reasonable time. I think I will disable the new test for DX12 in this PR, and treat it as a follow-up issue for somebody who is in a better position to fix it. |
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 fantastic.
Please file a follow-up issue for fixing the test on DX12. You can just leave it for others to triage.
There's an unrelated timeout on mach aarch64. I'm going to try re-running, and if it goes away we'll rebase and merge this. |
I filed #4096 for the aarch64 timeout. |
Checklist
cargo clippy
.cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
None
Description
Metal requires that a MTLCommandEncoder must be closed before it is deallocated, otherwise Metal will assert that endEncoding was not called. This manifests as a crash in CTS tests that might otherwise be failures or timeouts.
Testing
CTS tests that are expected fail on Metal will no longer crash.