@@ -29,15 +29,17 @@ impl Drop for super::Adapter {
2929
3030impl super :: Adapter {
3131 pub unsafe fn report_live_objects ( & self ) {
32- if let Ok ( debug_device) = self
33- . raw
34- . cast :: < d3d12sdklayers:: ID3D12DebugDevice > ( )
35- . into_result ( )
36- {
37- debug_device. ReportLiveDeviceObjects (
38- d3d12sdklayers:: D3D12_RLDO_SUMMARY | d3d12sdklayers:: D3D12_RLDO_IGNORE_INTERNAL ,
39- ) ;
40- debug_device. destroy ( ) ;
32+ if let Ok ( debug_device) = unsafe {
33+ self . raw
34+ . cast :: < d3d12sdklayers:: ID3D12DebugDevice > ( )
35+ . into_result ( )
36+ } {
37+ unsafe {
38+ debug_device. ReportLiveDeviceObjects (
39+ d3d12sdklayers:: D3D12_RLDO_SUMMARY | d3d12sdklayers:: D3D12_RLDO_IGNORE_INTERNAL ,
40+ )
41+ } ;
42+ unsafe { debug_device. destroy ( ) } ;
4143 }
4244 }
4345
@@ -365,35 +367,33 @@ impl crate::Adapter<super::Api> for super::Adapter {
365367
366368 let mut data = d3d12:: D3D12_FEATURE_DATA_FORMAT_SUPPORT {
367369 Format : raw_format,
368- Support1 : mem:: zeroed ( ) ,
369- Support2 : mem:: zeroed ( ) ,
370+ Support1 : unsafe { mem:: zeroed ( ) } ,
371+ Support2 : unsafe { mem:: zeroed ( ) } ,
370372 } ;
371- assert_eq ! (
372- winerror:: S_OK ,
373+ assert_eq ! ( winerror:: S_OK , unsafe {
373374 self . device. CheckFeatureSupport (
374375 d3d12:: D3D12_FEATURE_FORMAT_SUPPORT ,
375376 & mut data as * mut _ as * mut _,
376377 mem:: size_of:: <d3d12:: D3D12_FEATURE_DATA_FORMAT_SUPPORT >( ) as _,
377378 )
378- ) ;
379+ } ) ;
379380
380381 // Because we use a different format for SRV and UAV views of depth textures, we need to check
381382 // the features that use SRV/UAVs using the no-depth format.
382383 let mut data_no_depth = d3d12:: D3D12_FEATURE_DATA_FORMAT_SUPPORT {
383384 Format : no_depth_format,
384- Support1 : mem:: zeroed ( ) ,
385- Support2 : mem:: zeroed ( ) ,
385+ Support1 : unsafe { mem:: zeroed ( ) } ,
386+ Support2 : unsafe { mem:: zeroed ( ) } ,
386387 } ;
387388 if raw_format != no_depth_format {
388389 // Only-recheck if we're using a different format
389- assert_eq ! (
390- winerror:: S_OK ,
390+ assert_eq ! ( winerror:: S_OK , unsafe {
391391 self . device. CheckFeatureSupport (
392392 d3d12:: D3D12_FEATURE_FORMAT_SUPPORT ,
393393 & mut data_no_depth as * mut _ as * mut _,
394394 mem:: size_of:: <d3d12:: D3D12_FEATURE_DATA_FORMAT_SUPPORT >( ) as _,
395395 )
396- ) ;
396+ } ) ;
397397 } else {
398398 // Same format, just copy over.
399399 data_no_depth = data;
@@ -462,8 +462,8 @@ impl crate::Adapter<super::Api> for super::Adapter {
462462 let current_extent = {
463463 match surface. target {
464464 SurfaceTarget :: WndHandle ( wnd_handle) => {
465- let mut rect: windef:: RECT = mem:: zeroed ( ) ;
466- if winuser:: GetClientRect ( wnd_handle, & mut rect) != 0 {
465+ let mut rect: windef:: RECT = unsafe { mem:: zeroed ( ) } ;
466+ if unsafe { winuser:: GetClientRect ( wnd_handle, & mut rect) } != 0 {
467467 Some ( wgt:: Extent3d {
468468 width : ( rect. right - rect. left ) as u32 ,
469469 height : ( rect. bottom - rect. top ) as u32 ,
0 commit comments