-
Notifications
You must be signed in to change notification settings - Fork 952
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
d3d12: null-check the ComPtr produced by some creation functions #5096
Conversation
78fa1e8
to
ec1a922
Compare
ec1a922
to
1aabe48
Compare
My understanding is that we shouldn't need to (The d3d12 docs aren't very specific about that), but we have evidence that these functions sometimes leave the resource pointer set to null without returning an error.
1aabe48
to
a20d891
Compare
Edit: Nevermind, the stack for this specific bug corresponds to a slightly older wgpu revision that does not check the hresult in |
So, it seems that the docs of:
but not of:
mention something along the lines of:
I don't really understand what they mean by "capability testing" but if we want to treat wgpu/wgpu-hal/src/auxil/dxgi/result.rs Lines 11 to 13 in 063e110
Some relevant resources: |
That's different. We are passing these functions a pointer to a ComPtr. What this part of the docs refers to is that if we pass a null pointer (instead of a pointer to a null pointer), then the API treats it as a dry run. Here we are passing a non-null pointer to a null ComPtr in which case they are meant to populate the ComPtr with some object in case of success. |
Ahh, I see! |
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, we can consolidate the null check and the error check later.
FTR: The hope I've had here is to eventually add some type state that we use instead of the current CC @jimblandy, @cwfitzgerald, @Wumpf. |
…5096) My understanding is that we shouldn't need to (The d3d12 docs aren't very specific about that), but we have evidence that these functions sometimes leave the resource pointer set to null without returning an error.
I think what was happening is that the code in our bindings was creating a texture via |
Description
This PR makes the d3d12 a bit more defensive about the output of Create* functions
My understanding is that we shouldn't need to (although the d3d12 docs aren't very specific about that), but we have evidence that these functions sometimes leave the resource pointer set to null without returning an error.
Checklist
cargo fmt
.cargo clippy
.cargo xtask test
to run tests.