Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Switch out winapi to windows-rs #298

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update device.rs
  • Loading branch information
dklassic committed Aug 12, 2024
commit f241f896738fdf9c9ad838204a8b6e714220d17e
22 changes: 10 additions & 12 deletions src/platform/windows/angle/device.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,9 @@ use windows::Win32::Graphics::Direct3D::{
use windows::Win32::Graphics::Direct3D11::{
D3D11CreateDevice, ID3D11Device, D3D11_CREATE_DEVICE_FLAG, D3D11_SDK_VERSION,
};
use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory1, IDXGIAdapter, IDXGIDevice, IDXGIFactory1};
use windows::Win32::Graphics::Dxgi::{
CreateDXGIFactory1, IDXGIAdapter, IDXGIDevice, IDXGIFactory1,
};

use super::connection::Connection;
use crate::egl;
@@ -26,8 +28,6 @@ use std::mem;
use std::os::raw::c_void;
use std::ptr;

const INFINITE: u32 = 0xFFFFFFFF;

thread_local! {
static DXGI_FACTORY: RefCell<Option<IDXGIFactory1>> = RefCell::new(None);
}
@@ -140,7 +140,7 @@ impl Device {
let d3d_driver_type = adapter.d3d_driver_type;
unsafe {
let mut d3d11_device = Default::default();
let mut d3d11_feature_level = ptr::null_mut();
let d3d11_feature_level = ptr::null_mut();
let mut d3d11_device_context = Default::default();
let d3d11_adapter: IDXGIAdapter = if d3d_driver_type == D3D_DRIVER_TYPE_WARP {
IDXGIAdapter::from_raw(ptr::null_mut())
@@ -201,14 +201,12 @@ impl Device {
}

pub(crate) fn from_native_device(native_device: NativeDevice) -> Result<Device, Error> {
unsafe {
Ok(Device {
egl_display: native_device.egl_display,
d3d11_device: native_device.d3d11_device,
d3d_driver_type: native_device.d3d_driver_type,
display_is_owned: false,
})
}
Ok(Device {
egl_display: native_device.egl_display,
d3d11_device: native_device.d3d11_device,
d3d_driver_type: native_device.d3d_driver_type,
display_is_owned: false,
})
}

#[allow(non_snake_case)]