diff --git a/Cargo.toml b/Cargo.toml index 55bd80d873..aa2d305d70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/gfx-rs/d3d12-rs" keywords = ["windows", "graphics"] license = "MIT OR Apache-2.0" documentation = "https://docs.rs/d3d12" -categories = ["memory-management"] +categories = ["api-bindings", "graphics", "memory-management", "os::windows-apis"] +edition = "2018" [features] implicit-link = [] diff --git a/src/com.rs b/src/com.rs index dc76b6f3c1..7007060a13 100644 --- a/src/com.rs +++ b/src/com.rs @@ -1,11 +1,11 @@ -use std::fmt; -use std::hash::{Hash, Hasher}; -use std::ops::Deref; -use std::ptr; -use winapi::ctypes::c_void; -use winapi::um::unknwnbase::IUnknown; -use winapi::Interface; -use D3DResult; +use crate::D3DResult; +use std::{ + fmt, + hash::{Hash, Hasher}, + ops::Deref, + ptr, +}; +use winapi::{ctypes::c_void, um::unknwnbase::IUnknown, Interface}; #[repr(transparent)] pub struct WeakPtr(*mut T); diff --git a/src/command_allocator.rs b/src/command_allocator.rs index 93bf38ccee..15b373583e 100644 --- a/src/command_allocator.rs +++ b/src/command_allocator.rs @@ -1,6 +1,6 @@ //! Command Allocator -use com::WeakPtr; +use crate::com::WeakPtr; use winapi::um::d3d12; pub type CommandAllocator = WeakPtr; diff --git a/src/command_list.rs b/src/command_list.rs index d756ced45a..4fc3f6ea48 100644 --- a/src/command_list.rs +++ b/src/command_list.rs @@ -1,14 +1,12 @@ //! Graphics command list -use com::WeakPtr; -use resource::DiscardRegion; +use crate::{ + com::WeakPtr, resource::DiscardRegion, CommandAllocator, CpuDescriptor, DescriptorHeap, Format, + GpuAddress, GpuDescriptor, IndexCount, InstanceCount, PipelineState, Rect, Resource, + RootSignature, VertexCount, VertexOffset, WorkGroupCount, HRESULT, +}; use std::{mem, ptr}; use winapi::um::d3d12; -use { - CommandAllocator, CpuDescriptor, DescriptorHeap, Format, GpuAddress, GpuDescriptor, IndexCount, - InstanceCount, PipelineState, Rect, Resource, RootSignature, VertexCount, VertexOffset, - WorkGroupCount, HRESULT, -}; #[repr(u32)] #[derive(Clone, Copy)] diff --git a/src/debug.rs b/src/debug.rs index 5f8445be63..d7768191b7 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,4 +1,4 @@ -use com::WeakPtr; +use crate::com::WeakPtr; use winapi::um::d3d12sdklayers; #[cfg(any(feature = "libloading", feature = "implicit-link"))] use winapi::Interface as _; diff --git a/src/descriptor.rs b/src/descriptor.rs index 7a3cd8095e..2304e259cc 100644 --- a/src/descriptor.rs +++ b/src/descriptor.rs @@ -1,9 +1,6 @@ -use com::WeakPtr; -use std::mem; -use std::ops::Range; -use winapi::shared::dxgiformat; -use winapi::um::d3d12; -use {Blob, D3DResult, Error, TextureAddressMode}; +use crate::{com::WeakPtr, Blob, D3DResult, Error, TextureAddressMode}; +use std::{mem, ops::Range}; +use winapi::{shared::dxgiformat, um::d3d12}; pub type CpuDescriptor = d3d12::D3D12_CPU_DESCRIPTOR_HANDLE; pub type GpuDescriptor = d3d12::D3D12_GPU_DESCRIPTOR_HANDLE; diff --git a/src/device.rs b/src/device.rs index 9a52356509..188eb40b1d 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1,18 +1,16 @@ //! Device -use com::WeakPtr; -use command_list::{CmdListType, CommandSignature, IndirectArgument}; -use descriptor::{CpuDescriptor, DescriptorHeapFlags, DescriptorHeapType, RenderTargetViewDesc}; -use heap::{Heap, HeapFlags, HeapProperties}; -use std::ops::Range; -use winapi::um::d3d12; -use winapi::Interface; -use {pso, query, queue}; -use { - Blob, CachedPSO, CommandAllocator, CommandQueue, D3DResult, DescriptorHeap, Fence, - GraphicsCommandList, NodeMask, PipelineState, QueryHeap, Resource, RootSignature, Shader, - TextureAddressMode, +use crate::{ + com::WeakPtr, + command_list::{CmdListType, CommandSignature, IndirectArgument}, + descriptor::{CpuDescriptor, DescriptorHeapFlags, DescriptorHeapType, RenderTargetViewDesc}, + heap::{Heap, HeapFlags, HeapProperties}, + pso, query, queue, Blob, CachedPSO, CommandAllocator, CommandQueue, D3DResult, DescriptorHeap, + Fence, GraphicsCommandList, NodeMask, PipelineState, QueryHeap, Resource, RootSignature, + Shader, TextureAddressMode, }; +use std::ops::Range; +use winapi::{um::d3d12, Interface}; pub type Device = WeakPtr; diff --git a/src/dxgi.rs b/src/dxgi.rs index 2db54049ed..04c00afb06 100644 --- a/src/dxgi.rs +++ b/src/dxgi.rs @@ -1,10 +1,10 @@ -use com::WeakPtr; +use crate::{com::WeakPtr, CommandQueue, D3DResult, Resource, SampleDesc, HRESULT}; use std::ptr; -use winapi::shared::windef::HWND; -use winapi::shared::{dxgi, dxgi1_2, dxgi1_3, dxgi1_4, dxgiformat, dxgitype}; -use winapi::um::{d3d12, dxgidebug}; -use winapi::Interface; -use {CommandQueue, D3DResult, Resource, SampleDesc, HRESULT}; +use winapi::{ + shared::{dxgi, dxgi1_2, dxgi1_3, dxgi1_4, dxgiformat, dxgitype, windef::HWND}, + um::{d3d12, dxgidebug}, + Interface, +}; bitflags! { pub struct FactoryCreationFlags: u32 { diff --git a/src/heap.rs b/src/heap.rs index de97dbf506..9c23bcf082 100644 --- a/src/heap.rs +++ b/src/heap.rs @@ -1,4 +1,4 @@ -use com::WeakPtr; +use crate::com::WeakPtr; use winapi::um::d3d12; pub type Heap = WeakPtr; diff --git a/src/lib.rs b/src/lib.rs index 0fe4702058..37e1f2ee27 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,11 @@ -extern crate winapi; #[macro_use] extern crate bitflags; use std::ffi::CStr; -use winapi::shared::dxgiformat; -use winapi::um::{d3d12, d3dcommon}; +use winapi::{ + shared::dxgiformat, + um::{d3d12, d3dcommon}, +}; mod com; mod command_allocator; diff --git a/src/pso.rs b/src/pso.rs index 365f4ad948..e7dbc0a34b 100644 --- a/src/pso.rs +++ b/src/pso.rs @@ -1,10 +1,8 @@ //! Pipeline state -use com::WeakPtr; -use std::ops::Deref; -use std::{ffi, ptr}; +use crate::{com::WeakPtr, Blob, D3DResult, Error}; +use std::{ffi, ops::Deref, ptr}; use winapi::um::{d3d12, d3dcompiler}; -use {Blob, D3DResult, Error}; bitflags! { pub struct PipelineStateFlags: u32 { diff --git a/src/query.rs b/src/query.rs index 0620b73ea9..b5925c860b 100644 --- a/src/query.rs +++ b/src/query.rs @@ -1,4 +1,4 @@ -use com::WeakPtr; +use crate::com::WeakPtr; use winapi::um::d3d12; #[repr(u32)] diff --git a/src/queue.rs b/src/queue.rs index d1bd0f4083..0f3a865c97 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -1,8 +1,5 @@ -use crate::CommandList; -use com::WeakPtr; -use sync::Fence; +use crate::{com::WeakPtr, sync::Fence, CommandList, HRESULT}; use winapi::um::d3d12; -use HRESULT; #[repr(u32)] pub enum Priority { diff --git a/src/resource.rs b/src/resource.rs index f87b8768d3..a1242228cd 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -1,10 +1,8 @@ //! GPU Resource -use com::WeakPtr; -use std::ops::Range; -use std::ptr; +use crate::{com::WeakPtr, D3DResult, Rect}; +use std::{ops::Range, ptr}; use winapi::um::d3d12; -use {D3DResult, Rect}; pub type Subresource = u32; diff --git a/src/sync.rs b/src/sync.rs index 77d8b17c93..f1f3bb9bca 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -1,8 +1,6 @@ -use com::WeakPtr; +use crate::{com::WeakPtr, HRESULT}; use std::ptr; -use winapi::um::d3d12; -use winapi::um::{synchapi, winnt}; -use HRESULT; +use winapi::um::{d3d12, synchapi, winnt}; #[derive(Copy, Clone)] #[repr(transparent)]