@@ -814,51 +814,46 @@ impl super::Device {
814814 let mut external_memory_image_info = vk:: ExternalMemoryImageCreateInfo :: default ( )
815815 . handle_types ( vk:: ExternalMemoryHandleTypeFlags :: D3D11_TEXTURE ) ;
816816
817- let ImageWithoutMemory {
818- raw,
819- requirements,
820- copy_size,
821- view_formats,
822- raw_flags,
823- } = self . create_image_without_memory ( desc, Some ( & mut external_memory_image_info) ) ?;
817+ let image =
818+ self . create_image_without_memory ( desc, Some ( & mut external_memory_image_info) ) ?;
824819
825820 let mut import_memory_info = vk:: ImportMemoryWin32HandleInfoKHR :: default ( )
826821 . handle_type ( vk:: ExternalMemoryHandleTypeFlags :: D3D11_TEXTURE )
827822 . handle ( d3d11_shared_handle. 0 as _ ) ;
828823
829824 let mem_type_index = self
830825 . find_memory_type_index (
831- requirements. memory_type_bits ,
826+ image . requirements . memory_type_bits ,
832827 vk:: MemoryPropertyFlags :: DEVICE_LOCAL ,
833828 )
834829 . ok_or ( crate :: DeviceError :: ResourceCreationFailed ) ?;
835830
836831 let memory_allocate_info = vk:: MemoryAllocateInfo :: default ( )
837- . allocation_size ( requirements. size )
832+ . allocation_size ( image . requirements . size )
838833 . memory_type_index ( mem_type_index as _ )
839834 . push_next ( & mut import_memory_info) ;
840835 let memory = unsafe { self . shared . raw . allocate_memory ( & memory_allocate_info, None ) }
841836 . map_err ( super :: map_host_device_oom_err) ?;
842837
843- unsafe { self . shared . raw . bind_image_memory ( raw, memory, 0 ) }
838+ unsafe { self . shared . raw . bind_image_memory ( image . raw , memory, 0 ) }
844839 . map_err ( super :: map_host_device_oom_err) ?;
845840
846841 if let Some ( label) = desc. label {
847- unsafe { self . shared . set_object_name ( raw, label) } ;
842+ unsafe { self . shared . set_object_name ( image . raw , label) } ;
848843 }
849844
850845 self . counters . textures . add ( 1 ) ;
851846
852847 Ok ( super :: Texture {
853- raw,
848+ raw : image . raw ,
854849 drop_guard : None ,
855850 external_memory : Some ( memory) ,
856851 block : None ,
857852 usage : desc. usage ,
858853 format : desc. format ,
859- raw_flags,
860- copy_size,
861- view_formats,
854+ raw_flags : image . raw_flags ,
855+ copy_size : image . copy_size ,
856+ view_formats : image . view_formats ,
862857 } )
863858 }
864859
@@ -1195,22 +1190,16 @@ impl crate::Device for super::Device {
11951190 & self ,
11961191 desc : & crate :: TextureDescriptor ,
11971192 ) -> Result < super :: Texture , crate :: DeviceError > {
1198- let ImageWithoutMemory {
1199- raw,
1200- requirements,
1201- copy_size,
1202- view_formats,
1203- raw_flags,
1204- } = self . create_image_without_memory ( desc, None ) ?;
1193+ let image = self . create_image_without_memory ( desc, None ) ?;
12051194
12061195 let block = unsafe {
12071196 self . mem_allocator . lock ( ) . alloc (
12081197 & * self . shared ,
12091198 gpu_alloc:: Request {
1210- size : requirements. size ,
1211- align_mask : requirements. alignment - 1 ,
1199+ size : image . requirements . size ,
1200+ align_mask : image . requirements . alignment - 1 ,
12121201 usage : gpu_alloc:: UsageFlags :: FAST_DEVICE_ACCESS ,
1213- memory_types : requirements. memory_type_bits & self . valid_ash_memory_types ,
1202+ memory_types : image . requirements . memory_type_bits & self . valid_ash_memory_types ,
12141203 } ,
12151204 ) ?
12161205 } ;
@@ -1220,26 +1209,26 @@ impl crate::Device for super::Device {
12201209 unsafe {
12211210 self . shared
12221211 . raw
1223- . bind_image_memory ( raw, * block. memory ( ) , block. offset ( ) )
1212+ . bind_image_memory ( image . raw , * block. memory ( ) , block. offset ( ) )
12241213 . map_err ( super :: map_host_device_oom_err) ?
12251214 } ;
12261215
12271216 if let Some ( label) = desc. label {
1228- unsafe { self . shared . set_object_name ( raw, label) } ;
1217+ unsafe { self . shared . set_object_name ( image . raw , label) } ;
12291218 }
12301219
12311220 self . counters . textures . add ( 1 ) ;
12321221
12331222 Ok ( super :: Texture {
1234- raw,
1223+ raw : image . raw ,
12351224 drop_guard : None ,
12361225 external_memory : None ,
12371226 block : Some ( block) ,
12381227 usage : desc. usage ,
12391228 format : desc. format ,
1240- raw_flags,
1241- copy_size,
1242- view_formats,
1229+ raw_flags : image . raw_flags ,
1230+ copy_size : image . copy_size ,
1231+ view_formats : image . view_formats ,
12431232 } )
12441233 }
12451234 unsafe fn destroy_texture ( & self , texture : super :: Texture ) {
0 commit comments