File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -737,7 +737,14 @@ impl super::Device {
737
737
// VK_ERROR_COMPRESSION_EXHAUSTED_EXT
738
738
super :: map_host_device_oom_and_ioca_err ( err)
739
739
}
740
- let req = unsafe { self . shared . raw . get_image_memory_requirements ( raw) } ;
740
+ let mut req = unsafe { self . shared . raw . get_image_memory_requirements ( raw) } ;
741
+
742
+ if desc. usage . contains ( wgt:: TextureUses :: TRANSIENT ) {
743
+ let mem_type_index = self . find_memory_type_index ( req. memory_type_bits , vk:: MemoryPropertyFlags :: LAZILY_ALLOCATED ) ;
744
+ if let Some ( mem_type_index) = mem_type_index {
745
+ req. memory_type_bits = 1 << mem_type_index;
746
+ }
747
+ }
741
748
742
749
Ok ( ImageWithoutMemory {
743
750
raw,
@@ -1263,19 +1270,13 @@ impl crate::Device for super::Device {
1263
1270
unsafe { self . shared . raw . destroy_image ( image. raw , None ) } ;
1264
1271
} ) ?;
1265
1272
1266
- let mut alloc_usage = gpu_alloc:: UsageFlags :: FAST_DEVICE_ACCESS ;
1267
- alloc_usage. set (
1268
- gpu_alloc:: UsageFlags :: TRANSIENT ,
1269
- desc. usage . contains ( wgt:: TextureUses :: TRANSIENT ) ,
1270
- ) ;
1271
-
1272
1273
let block = unsafe {
1273
1274
self . mem_allocator . lock ( ) . alloc (
1274
1275
& * self . shared ,
1275
1276
gpu_alloc:: Request {
1276
1277
size : image. requirements . size ,
1277
1278
align_mask : image. requirements . alignment - 1 ,
1278
- usage : alloc_usage ,
1279
+ usage : gpu_alloc :: UsageFlags :: FAST_DEVICE_ACCESS ,
1279
1280
memory_types : image. requirements . memory_type_bits & self . valid_ash_memory_types ,
1280
1281
} ,
1281
1282
)
You can’t perform that action at this time.
0 commit comments