-
Notifications
You must be signed in to change notification settings - Fork 512
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
Functions taking a pointer to an array of pointers get confusing signatures #2105
Comments
The general problem is that the metadata doesn't indicate that the API expects non-null COM interface pointers so it assumes they can all be null, and thus uses |
I suppose there are two parts here:
|
That would be great but an uphill battle that is unlikely to be comprehensive.
Yes, that may be possible. I can experiment to see how effective/practical that may be. |
This looks much like #1339. |
|
Unfortunate that #2233 had to be reverted. Currently I have to use self.context.OMSetRenderTargets(Some(&[Some(self.render_target_view.clone())]), None) In addition to it being quite ugly, the signature currently forces an unnecessary clone. It would be strictly easier for me to use without the Options getting in the way: self.context.OMSetRenderTargets(&self.render_target_view as *mut _, std::ptr::null_mut()) or even self.context.OMSetRenderTargets(std::slice::from_ref(&self.render_target_view).as_mut_ptr(), std::ptr::null_mut()) |
There may be further options here now that I've dramatically simplified the parameter binding machinery (#2360). |
I've run into an issue with
ID3D11DeviceContext::OMSetRenderTargets()
where the original takes a pointer to an array of const pointers toID3D11RenderTargetView
, but the Rust version takes anOption<&[Option<ID3D11RenderTargetView>]>
. As best as I can tell, it should really just be taking an&[ID3D11RenderTargetView]
, because it certainly makes no sense to be passing in NULLs in that API. In addition, the current version complicates things by requiring you to moveID3D11RenderTargetView
to pass it in. If it took an&[ID3D11RenderTargetView]
instead, you could avoid the move by usingstd::slice::from_ref()
.The text was updated successfully, but these errors were encountered: