Skip to content

Comparison

MaulingMonkey edited this page Sep 25, 2022 · 6 revisions

Overall

Why not winapi/windows directly?

  • This crate aims to have real doc comments for one-stop intellisense, safety documentation, etc.
  • This crate aims to make fns safe/sound/slightly rusty when possible. windows has started to broadly attempt this for UWP APIs as well, but this has resulted in wide sweeping soundness bugs, and Win32/DirectX remain exiled to unsafe-land.
  • This crate attempts to verify individual API soundness through mass unit tests, fuzzing, etc. focused on DirectX's behavior specifically - to the point of aiming to work around what are arguably DirectX bugs.

Why not <crate that abstracts away DirectX>?

  • Most other crates attempt to hide the underlying API as much as possible, improving application portability by sacrificing interoperability with existing DirectX code.
  • This crate instead surfaces the underlying API as much as possible, improving interoperability with existing DirectX-based code. Commonly, gamedev C++ middleware will accept e.g. Direct3D device/surface pointers to render to etc.
  • This crate could potentially become a middle layer that abstraction crates use for sounder internals?

Comparison Table

category thindx winapi windows windows-sys
docs ✔️ artisinal [1] ⚠️ api shape ⚠️ api shape, no docs.rs ⚠️ api shape
semver ⚠️ major churn ✔️ stable 0.3.x ⚠️ major churn ⚠️ major churn
safety ✔️ lots [2] ❌ none ⚠️ not for DirectX ❌ none
soundness ❌ unsound ⚠️ 100% unsafe ❌ unsound ⚠️ 100% unsafe
bloat ⚠️ safety checks ✔️ lean ⚠️ conversion traits ⚠️ too lean: COM ptrs are void*
  • [1]: docs, examples, crosslinks to https://docs.microsoft.com/
  • [2]: safe fns everywhere possible and reasonable + safer abstractions than raw FFI even when unsafe is required

Other Alternatives