@@ -23,10 +23,10 @@ namespace magma
23
23
return DeviceMemory<>(DeviceMemoryDeleter{magma::Device<claws::no_delete>(*this )}, vk::Device::allocateMemory ({size, typeIndex}));
24
24
}
25
25
26
- inline auto impl::Device::selectAndCreateDeviceMemory (vk::PhysicalDevice physicalDevice,
27
- vk::DeviceSize size,
28
- vk::MemoryPropertyFlags memoryFlags,
29
- uint32_t memoryTypeIndexMask) const
26
+ inline auto selectDeviceMemoryType (vk::PhysicalDevice physicalDevice,
27
+ vk::DeviceSize size,
28
+ vk::MemoryPropertyFlags memoryFlags,
29
+ uint32_t memoryTypeIndexMask)
30
30
{
31
31
auto const memProperties (physicalDevice.getMemoryProperties ());
32
32
@@ -35,8 +35,16 @@ namespace magma
35
35
auto const &type (memProperties.memoryTypes [i]);
36
36
37
37
if (((memoryTypeIndexMask >> i) & 1u ) && (type.propertyFlags & memoryFlags) && memProperties.memoryHeaps [type.heapIndex ].size >= size)
38
- return createDeviceMemory (size, i) ;
38
+ return i ;
39
39
}
40
40
throw std::runtime_error (" Couldn't find proper memory type" );
41
41
}
42
+
43
+ inline auto impl::Device::selectAndCreateDeviceMemory (vk::PhysicalDevice physicalDevice,
44
+ vk::DeviceSize size,
45
+ vk::MemoryPropertyFlags memoryFlags,
46
+ uint32_t memoryTypeIndexMask) const
47
+ {
48
+ return createDeviceMemory (size, selectDeviceMemoryType (physicalDevice, size, memoryFlags, memoryTypeIndexMask));
49
+ }
42
50
};
0 commit comments