Skip to content

Commit

Permalink
windows-rs 0.58
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Jul 21, 2024
1 parent b09b288 commit 75abb72
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 68 deletions.
108 changes: 64 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ impl Global {
) -> Result<SurfaceId, CreateSurfaceError> {
profiling::scope!("Instance::instance_create_surface_from_surface_handle");
self.instance_create_surface_dx12(id_in, |inst| unsafe {
inst.create_surface_from_surface_handle(surface_handle as _)
inst.create_surface_from_surface_handle(surface_handle)
})
}

Expand All @@ -665,7 +665,7 @@ impl Global {
) -> Result<SurfaceId, CreateSurfaceError> {
profiling::scope!("Instance::instance_create_surface_from_swap_chain_panel");
self.instance_create_surface_dx12(id_in, |inst| unsafe {
inst.create_surface_from_swap_chain_panel(swap_chain_panel as _)
inst.create_surface_from_swap_chain_panel(swap_chain_panel)
})
}

Expand Down
6 changes: 3 additions & 3 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ libloading = { version = "0.8", optional = true }
# backend: Dx12
bit-set = { version = "0.6", optional = true }
range-alloc = { version = "0.1", optional = true }
gpu-allocator = {version = "0.27", default-features = false, optional = true }
gpu-allocator = { version = "0.27", default-features = false, optional = true }
hassle-rs = { version = "0.11", optional = true }
# backend: Gles
glutin_wgl_sys = { version = "0.6", optional = true }
Expand All @@ -153,8 +153,8 @@ winapi = { version = "0.3", features = [
"dcomp",
] }
# For core macros. This crate is also reexported as windows::core.
windows-core = { version = "0.57.0", optional = true }
windows = { version = "0.57.0", optional = true, features = [
windows-core = { version = "0.58.0", optional = true }
windows = { version = "0.58.0", optional = true, features = [
"Win32_Graphics_Direct3D_Fxc",
"Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D12",
Expand Down
5 changes: 2 additions & 3 deletions wgpu-hal/src/auxil/dxgi/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub enum DxgiFactoryType {
}

fn should_keep_adapter(adapter: &Dxgi::IDXGIAdapter1) -> bool {
let mut desc = unsafe { std::mem::zeroed() };
unsafe { adapter.GetDesc1(&mut desc) }.unwrap();
let desc = unsafe { adapter.GetDesc1() }.unwrap();

// The Intel Haswell family of iGPUs had support for the D3D12 API but it was later
// removed due to a security vulnerability.
Expand Down Expand Up @@ -227,7 +226,7 @@ pub fn create_factory(
crate::InstanceError::with_source(String::from("failed to load dxgi.dll"), e)
})?;

let mut factory_flags = 0;
let mut factory_flags = Dxgi::DXGI_CREATE_FACTORY_FLAGS::default();

if instance_flags.contains(wgt::InstanceFlags::VALIDATION) {
// The `DXGI_CREATE_FACTORY_DEBUG` flag is only allowed to be passed to
Expand Down
3 changes: 1 addition & 2 deletions wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ impl super::Adapter {

// We have found a possible adapter.
// Acquire the device information.
let mut desc: Dxgi::DXGI_ADAPTER_DESC2 = unsafe { mem::zeroed() };
unsafe { adapter.unwrap_adapter2().GetDesc2(&mut desc) }.unwrap();
let desc = unsafe { adapter.unwrap_adapter2().GetDesc2() }.unwrap();

let device_name = auxil::dxgi::conv::map_adapter_name(desc.Description);

Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
desc.color_attachments.len() as u32,
Some(color_views.as_ptr()),
false,
ds_view.as_ref().map(|v| v as _),
ds_view.as_ref().map(|v| v as *const _),
)
};

Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/src/dx12/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl FixedSizeHeap {
) -> Result<Self, crate::DeviceError> {
let desc = Direct3D12::D3D12_DESCRIPTOR_HEAP_DESC {
Type: ty,
NumDescriptors: HEAP_SIZE_FIXED as _,
NumDescriptors: HEAP_SIZE_FIXED as u32,
Flags: Direct3D12::D3D12_DESCRIPTOR_HEAP_FLAG_NONE,
NodeMask: 0,
};
Expand All @@ -135,7 +135,7 @@ impl FixedSizeHeap {
.into_device_result("Descriptor heap creation")?;

Ok(Self {
handle_size: unsafe { device.GetDescriptorHandleIncrementSize(ty) } as _,
handle_size: unsafe { device.GetDescriptorHandleIncrementSize(ty) } as usize,
availability: !0, // all free!
start: unsafe { heap.GetCPUDescriptorHandleForHeapStart() },
_raw: heap,
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ impl crate::Device for super::Device {
ParameterType: Direct3D12::D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE,
Anonymous: Direct3D12::D3D12_ROOT_PARAMETER_0 {
DescriptorTable: Direct3D12::D3D12_ROOT_DESCRIPTOR_TABLE {
NumDescriptorRanges: range.len() as _,
NumDescriptorRanges: range.len() as u32,
pDescriptorRanges: range.as_ptr(),
},
},
Expand Down
3 changes: 2 additions & 1 deletion wgpu-hal/src/dx12/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ impl crate::Instance for super::Instance {
raw_window_handle::RawWindowHandle::Win32(handle) => Ok(super::Surface {
factory: self.factory.clone(),
factory_media: self.factory_media.clone(),
target: SurfaceTarget::WndHandle(Foundation::HWND(handle.hwnd.get())),
// https://github.com/rust-windowing/raw-window-handle/issues/171
target: SurfaceTarget::WndHandle(Foundation::HWND(handle.hwnd.get() as *mut _)),
supports_allow_tearing: self.supports_allow_tearing,
swap_chain: RwLock::new(None),
}),
Expand Down
Loading

0 comments on commit 75abb72

Please sign in to comment.