Tags: MaulingMonkey/rust_win32_sample
Tags
Wrap COM types.
A goal here is to keep various methods 'safe'. This means they can't reasonably take raw pointers, which means we need
a "safe" wrapper type, and delegate the unsafety to the initial construction of said wrapper type. So, for example,
`ps_set_shader` no longer takes a `*mut ID3D11PixelShader`, instead it takes a `&PixelShader` which has the
preconditions that the underlying internal `*mut ID3D11PixelShader` is a valid non-null pointer with a positive refcount
that won't go away until the `PixelShader` itself is dropped.
So far I'm getting away with just having `&ID3D11Type` instead of introducing `TypeRef`... we'll see how long that holds.
Sweeping changes:
- Reduce boilerplate with new `com_wrapper!`
- Add MSDN links
- COM wrappers now take ownership of raw ptrs via `own` instead of `from` to disambgiuate from `From` trait method.
- Most d3d11 types moved from `d3d11` to `com::d3d11`
Less sweeping changes:
- Introduce `AsNativeSlice` to reduce unsafe boilerplate.
- `{d3d11 -> com}::DeviceAndSwapChain`
- `{d3d11 -> com::dxgi}::SwapChain`
New wrapper types:
- d3d11::Buffer
- d3d11::Texture2D
- d3d11::PixelShader
- d3d11::VertexShader
- d3d11::InputLayout
- d3d11::ClassInstance
- d3d11::ClassLinkage
- d3d11::RenderTargetView
- d3d11::DepthStencilView