Skip to content
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

ID3D12GraphicsCommandList4 bindings #789

Open
DethRaid opened this issue Jul 21, 2019 · 6 comments
Open

ID3D12GraphicsCommandList4 bindings #789

DethRaid opened this issue Jul 21, 2019 · 6 comments
Labels
missing api A request for a missing API

Comments

@DethRaid
Copy link

I'd love to use DirectX 12's render passes in my renderer, but I need bindings for ID3D12GraphicsCommandList4, and those seem to be missing from winapi-rs. What's the best way for me to add them? Should I hand-code them, or do you have a way to auto-generate the Rust bindings from the C++ headers?

@retep998
Copy link
Owner

For headers which are automatically generated from a .idl file, https://github.com/Arnavion/winapi-tlb-bindgen is used to generate bindings which are then cleaned up by hand. For everything else, it's pretty much by hand.

@DethRaid
Copy link
Author

Looks like there's a .idl file for d3d12, so that library should save me some time... but I can't seem to generate a .tlb from it. I'm invoking midl.exe like midl.exe d3d12.idl /tlb ./d3d12.tlb. I've double-checked that d3d12.idl is in the directory I'm calling midl.exe from. However, I don't end up with a .tlb file - Instead, I have .h, _i.c, and _p.c. I tried with the developer command prompts for both VS 2017 and 2019. Do you know how can I generate a .tlb file for d3d12.iml? Alternately, do you know how I can check if there's something in d3d12.iml that prevents generating a .tlb?

@retep998
Copy link
Owner

@Arnavion would be better suited to answer your questions.

@Arnavion
Copy link
Contributor

@Arnavion
Copy link
Contributor

FWIW, WindowsBunny had asked me for this header some time ago, so here you go: https://gist.github.com/Arnavion/990b26ef8d3f15a267ea9807e1183e00

Note that midl.exe generates a MIDL2413 along with the .tlb. Specifically the output does not contain a valid definition of D3D12_RAYTRACING_INSTANCE_DESC, because the original struct contains bitfields and midl.exe does not support generating .tlb for those.

I don't remember if anything else was broken in it. Use with caution.

@DethRaid
Copy link
Author

Ooh thanks, that's a big help! I can fix up that file, then PR it in

@retep998 retep998 added the missing api A request for a missing API label Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing api A request for a missing API
Projects
None yet
Development

No branches or pull requests

3 participants