Reputation: 305
I'm writing a memory manager in my project to manage Vulkan memory allocation. In practice, allocation counts should be smaller than maxMemoryAllocationCount
, so I counted all allocations in my app, and check if it exceeds maxMemoryAllocationCount
each allocation.
However, I think is design has bugs, because other apps could also allocate memories from the same device, so I need to get the allocation counts which are counted by the device, but I didn't find any kind of these APIs.
So do I miss something or maxMemoryAllocationCount
are application local?
Upvotes: 3
Views: 285
Reputation: 473302
other apps could also allocate memories from the same device
No, they cannot.
They can allocate memory from the same physical device. But they cannot allocate memory from the same VkDevice
object. Such objects are specific to the process and cannot be shared. The allocations can be shared, but not the devices themselves (note that a shared allocation counts against the limit on all devices that can access it).
The specification is very clear that this is bound to a specific VkDevice
:
The maximum number of valid memory allocations that can exist simultaneously within a
VkDevice
may be restricted by implementation-or-platform-dependent limits. ThemaxMemoryAllocationCount
feature describes the number of allocations that can exist simultaneously before encountering these internal limits.
When the specification says "device", unless it makes it clear otherwise, it means "VkDevice
", not "actual GPU".
Upvotes: 4