mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Convert to Rust2018
This commit is contained in:
@@ -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 = []
|
||||
|
||||
16
src/com.rs
16
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<T>(*mut T);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Command Allocator
|
||||
|
||||
use com::WeakPtr;
|
||||
use crate::com::WeakPtr;
|
||||
use winapi::um::d3d12;
|
||||
|
||||
pub type CommandAllocator = WeakPtr<d3d12::ID3D12CommandAllocator>;
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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 _;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<d3d12::ID3D12Device>;
|
||||
|
||||
|
||||
12
src/dxgi.rs
12
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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use com::WeakPtr;
|
||||
use crate::com::WeakPtr;
|
||||
use winapi::um::d3d12;
|
||||
|
||||
pub type Heap = WeakPtr<d3d12::ID3D12Heap>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use com::WeakPtr;
|
||||
use crate::com::WeakPtr;
|
||||
use winapi::um::d3d12;
|
||||
|
||||
#[repr(u32)]
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user