Expand description
🦀 thindx - Thin DirectX 🦀
Safer DirectX: Types, fns, lifetimes, tests, real docs, intellisense, examples, debug visualizers, …
🦀 | When | DirectX APIs |
---|---|---|
📦 | examples • rust ⮀ c++ • test coverage • lib.rs • docs.rs | |
✔️ | Now | thindx::{d3d9, d3d::Compiler, xaudio2, xinput} |
⚠️ | Soon™ | d3d11, d3d12, dxgi, dxcompiler, dinput |
⚠️ | Eventually | d2d, dcompute, dsound, dstorage, dwrite, dxr, xact3, uwp::input? |
❌ | Never? | d3d10, d3dx*, ddraw, dplay |
❌ This crate is probably unsound! ❌
I’m exposing a huge legacy C++ API to Rust. Mistakes will happen.
That said, soundness is a very high priority goal. thindx
will add things like extra bounds checks, parameter
validation, extra init, etc. if need be in order to ensure soundness in safe fns whenever possible. When it’s not
possible to validate unsoundness away, the fns in question should be marked unsafe
. This crate strives to be sounder
than whatever manual FFI you’d write yourself would be, and that’s a high bar.
But there are some practical limits to this. If a background driver thread invokes UB if it fails to allocate memory, without any direct correlation to specific API misuse like a large integer overflowing, that’s a bug I can’t sanely mitigate via safe fns. I mean, theoretically I could write a pure-software clone of the entire DirectX runtime… but no.
Additionally, while I’m seeking to validate my APIs via testing, older implementations of the APIs in question may have more bugs / unchecked parameters / ??? that I’ll fail to mitigate due to being unable to trigger them myself. While I’m happy to investigate, accept pull requests, expand test coverage, etc. it’s worth assuming this crate is unsound on older versions unless you’ve tested yourself.
⚠️ API major version churn ⚠️
0.0.0-yyyy-mm-dd
doesn’t follow semver.
Individual fn
s are likely to gain/lose unsafe
, traits, etc. in a neverending attempt to make DirectX access sound.
As such, thindx
itself will likely always suffer from major version churn.
This isn’t too much of a problem until two crates wish to share / pass thindx
types between themselves.
It might be possible to somewhat stabilize some types by exiling them into subcrates, but this has not yet been done.
Additionally, individual extension traits / functions / methods will likely never get the same treatment (no need?)
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Re-exports
pub extern crate abibool;
pub extern crate abistr;
pub use thindx_xaudio2::xaudio2_8;
pub use thindx_xaudio2::xaudio2_9;
pub use crate::errors::*;
Modules
Revision history
Examples
Rust ⮀ C++ coverage information based on Windows SDK 10.0.22621.0
C ABI interop types
Direct3D related types and APIs used across multiple Direct3D versions.
[docs.microsoft.com] Direct3D 9 related types and APIs
[docs.microsoft.com] Direct3D 11 related types and APIs (including shader reflection APIs)
General windows APIs
Well Known Private Data IDentifier s
[docs.microsoft.com] APIs for XAudio2 style audio output
[docs.microsoft.com] APIs for Xbox 360 style controllers
Macros
Structs
[docs.microsoft.com] HRESULT
[docs.microsoft.com] A 128-bit identifier used for COM interfaces, COM class objects, and various other purpouses.
[docs.microsoft.com] IUnknown
Traits
Indicates this type can be treated as an HWND.
Allow conversion to/from raw (winapi) pointer types.
Functions
[docs.microsoft.com] MAKEFOURCC
Type Definitions
= Guid [docs.microsoft.com] Class Identifier - used for uniquely identifying COM classes
= Guid [docs.microsoft.com] Format Identifier - used for tagging sections in e.g. structured storage property sets
= Guid [docs.microsoft.com] Iinterface Identifier - used for uniquely identifiying COM interfaces