Skip to content

Commit d686fbd

Browse files
dklassicmrobinson
authored andcommitted
perform cargo fmt
1 parent 334a990 commit d686fbd

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

src/platform/windows/wgl/device.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,10 @@ impl Adapter {
9898
let current_module = GetModuleHandleA(PCSTR::null());
9999
assert!(current_module.is_ok());
100100
let current_module = current_module.unwrap();
101-
let nvidia_gpu_select_variable = GetProcAddress(
102-
current_module,
103-
PCSTR(NVIDIA_GPU_SELECT_SYMBOL.as_ptr()),
104-
);
105-
let amd_gpu_select_variable = GetProcAddress(
106-
current_module,
107-
PCSTR(AMD_GPU_SELECT_SYMBOL.as_ptr()),
108-
);
101+
let nvidia_gpu_select_variable =
102+
GetProcAddress(current_module, PCSTR(NVIDIA_GPU_SELECT_SYMBOL.as_ptr()));
103+
let amd_gpu_select_variable =
104+
GetProcAddress(current_module, PCSTR(AMD_GPU_SELECT_SYMBOL.as_ptr()));
109105
if nvidia_gpu_select_variable.is_none() || amd_gpu_select_variable.is_none() {
110106
println!(
111107
"surfman: Could not find the NVIDIA and/or AMD GPU selection symbols. \

src/platform/windows/wgl/surface.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ use crate::gl;
1212
use crate::gl::types::{GLenum, GLint, GLuint};
1313
use crate::gl_utils;
1414
use euclid::default::Size2D;
15-
use windows::core::Interface;
16-
use windows::Win32::Graphics::Gdi::{GetDC, ReleaseDC};
17-
use windows::Win32::Graphics::OpenGL::{GetPixelFormat, SwapBuffers};
18-
use windows::Win32::UI::WindowsAndMessaging::GetWindowRect;
1915
use std::fmt::{self, Debug, Formatter};
2016
use std::marker::PhantomData;
2117
use std::mem;
2218
use std::os::raw::c_void;
2319
use std::ptr;
2420
use std::thread;
25-
use windows::Win32::Graphics::Dxgi::IDXGIResource;
26-
use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_R8G8B8A8_UNORM;
27-
use windows::Win32::Graphics::Dxgi::Common::DXGI_SAMPLE_DESC;
21+
use windows::core::Interface;
2822
use windows::Win32::Foundation::HANDLE;
2923
use windows::Win32::Foundation::HWND;
24+
use windows::Win32::Foundation::INVALID_HANDLE_VALUE;
3025
use windows::Win32::Graphics::Direct3D11::{ID3D11Texture2D, D3D11_USAGE_DEFAULT};
3126
use windows::Win32::Graphics::Direct3D11::{D3D11_BIND_RENDER_TARGET, D3D11_BIND_SHADER_RESOURCE};
3227
use windows::Win32::Graphics::Direct3D11::{
3328
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX, D3D11_TEXTURE2D_DESC,
3429
};
35-
use windows::Win32::Foundation::INVALID_HANDLE_VALUE;
30+
use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_R8G8B8A8_UNORM;
31+
use windows::Win32::Graphics::Dxgi::Common::DXGI_SAMPLE_DESC;
32+
use windows::Win32::Graphics::Dxgi::IDXGIResource;
33+
use windows::Win32::Graphics::Gdi::{GetDC, ReleaseDC};
34+
use windows::Win32::Graphics::OpenGL::{GetPixelFormat, SwapBuffers};
35+
use windows::Win32::UI::WindowsAndMessaging::GetWindowRect;
3636

3737
const SURFACE_GL_TEXTURE_TARGET: GLenum = gl::TEXTURE_2D;
3838

@@ -172,7 +172,7 @@ impl Device {
172172
CPUAccessFlags: 0,
173173
MiscFlags: D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX.0 as u32,
174174
};
175-
let mut d3d11_texture= Default::default();
175+
let mut d3d11_texture = Default::default();
176176
let mut result =
177177
self.d3d11_device
178178
.CreateTexture2D(&d3d11_texture2d_desc, None, d3d11_texture);
@@ -193,7 +193,7 @@ impl Device {
193193
assert!(result.is_ok());
194194
let mut dxgi_share_handle = result.unwrap();
195195
assert_ne!(dxgi_share_handle, INVALID_HANDLE_VALUE);
196-
196+
197197
// Tell GL about the share handle.
198198
let d3d11_texture = d3d11_texture;
199199
let ok = (dx_interop_functions.DXSetResourceShareHandleNV)(
@@ -246,7 +246,7 @@ impl Device {
246246

247247
// FIXME(pcwalton): Do we need to acquire the keyed mutex, or does the GL driver do
248248
// that?
249-
249+
250250
let d3d11_texture = (*d3d11_texture).to_owned().unwrap();
251251

252252
Ok(Surface {
@@ -392,17 +392,16 @@ impl Device {
392392
unsafe {
393393
// Create a new texture wrapping the shared handle.
394394
let mut local_d3d11_texture = Default::default();
395-
let result = self.d3d11_device.OpenSharedResource(
396-
dxgi_share_handle,
397-
&mut local_d3d11_texture,
398-
);
395+
let result = self
396+
.d3d11_device
397+
.OpenSharedResource(dxgi_share_handle, &mut local_d3d11_texture);
399398
if result.is_err() || local_d3d11_texture.is_none() {
400399
return Err((
401400
Error::SurfaceImportFailed(WindowingApiError::Failed),
402401
surface,
403402
));
404403
}
405-
let local_d3d11_texture : ID3D11Texture2D = local_d3d11_texture.unwrap();
404+
let local_d3d11_texture: ID3D11Texture2D = local_d3d11_texture.unwrap();
406405
// Make GL aware of the connection between the share handle and the texture.
407406
let ok = (dx_interop_functions.DXSetResourceShareHandleNV)(
408407
local_d3d11_texture.as_raw() as *mut c_void,

0 commit comments

Comments
 (0)