From 029c24d9cfaf4347efc157aebe01662b0aafb61b Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 31 Oct 2019 21:50:06 -0400 Subject: [PATCH] Preparations for 0.3 release Including: - rename feature "libstatic" to "implicit-link" - Debug and constructor implementations for the library structs - removal of redundant Heap definition --- Cargo.toml | 9 ++++++--- appveyor.yml | 2 +- src/debug.rs | 4 ++-- src/descriptor.rs | 2 +- src/device.rs | 2 +- src/dxgi.rs | 3 ++- src/lib.rs | 11 +++++++++++ src/resource.rs | 2 -- 8 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c7e24f2..8f83d84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "d3d12" -version = "0.2.2" -authors = ["msiglreith "] +version = "0.3.0" +authors = [ + "msiglreith ", + "Dzmitry Malyshau ", +] description = "Low level D3D12 API wrapper" repository = "https://github.com/gfx-rs/d3d12-rs" keywords = ["windows", "graphics"] @@ -10,7 +13,7 @@ documentation = "https://docs.rs/d3d12" categories = ["memory-management"] [features] -libstatic = [] +implicit-link = [] [dependencies] bitflags = "1" diff --git a/appveyor.yml b/appveyor.yml index f71194b..b947c52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,5 +25,5 @@ build: false test_script: - cargo check - cargo check --features libloading - - cargo check --features libstatic + - cargo check --features implicit-link - cargo check --all-features diff --git a/src/debug.rs b/src/debug.rs index a5d3d16..00ec522 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,5 +1,5 @@ use com::WeakPtr; -#[cfg(any(feature = "libloading", feature = "libstatic"))] +#[cfg(any(feature = "libloading", feature = "implicit-link"))] use winapi::Interface as _; use winapi::um::d3d12sdklayers; @@ -27,7 +27,7 @@ impl crate::D3D12Lib { } impl Debug { - #[cfg(feature = "libstatic")] + #[cfg(feature = "implicit-link")] pub fn get_interface() -> crate::D3DResult { let mut debug = Debug::null(); let hr = unsafe { diff --git a/src/descriptor.rs b/src/descriptor.rs index 3403e35..ecf4eed 100644 --- a/src/descriptor.rs +++ b/src/descriptor.rs @@ -245,7 +245,7 @@ impl crate::D3D12Lib { } impl RootSignature { - #[cfg(feature = "libstatic")] + #[cfg(feature = "implicit-link")] pub fn serialize( version: RootSignatureVersion, parameters: &[RootParameter], diff --git a/src/device.rs b/src/device.rs index 4e9307a..6393d9b 100644 --- a/src/device.rs +++ b/src/device.rs @@ -46,7 +46,7 @@ impl crate::D3D12Lib { } impl Device { - #[cfg(feature = "libstatic")] + #[cfg(feature = "implicit-link")] pub fn create( adapter: WeakPtr, feature_level: crate::FeatureLevel, diff --git a/src/dxgi.rs b/src/dxgi.rs index 14a971e..fe6c961 100644 --- a/src/dxgi.rs +++ b/src/dxgi.rs @@ -48,6 +48,7 @@ pub type SwapChain1 = WeakPtr; pub type SwapChain3 = WeakPtr; #[cfg(feature = "libloading")] +#[derive(Debug)] pub struct DxgiLib { lib: libloading::Library, } @@ -160,7 +161,7 @@ impl Factory2 { } impl Factory4 { - #[cfg(feature = "libstatic")] + #[cfg(feature = "implicit-link")] pub fn create(flags: FactoryCreationFlags) -> D3DResult { let mut factory = Factory4::null(); let hr = unsafe { diff --git a/src/lib.rs b/src/lib.rs index 71c7e78..d1e88e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,6 +85,17 @@ impl Error { } #[cfg(feature = "libloading")] +#[derive(Debug)] pub struct D3D12Lib { lib: libloading::Library, } + +#[cfg(feature = "libloading")] +impl D3D12Lib { + pub fn new() -> libloading::Result { + libloading::Library::new("d3d12.dll") + .map(|lib| D3D12Lib { + lib, + }) + } +} diff --git a/src/resource.rs b/src/resource.rs index dd866a9..f87b876 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -13,8 +13,6 @@ pub struct DiscardRegion<'a> { pub subregions: Range, } -pub type Heap = WeakPtr; - pub type Resource = WeakPtr; impl Resource {