While the definition of "video memory" isn't super clear, I think it's
pretty reasonable to assume host-memory isn't meant to be included. So
let's only count dedicated memory here.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3107
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5409>
get_video_mem(struct zink_screen *screen)
{
VkDeviceSize size = 0;
- for (uint32_t i = 0; i < screen->mem_props.memoryHeapCount; ++i)
- size += screen->mem_props.memoryHeaps[i].size;
+ for (uint32_t i = 0; i < screen->mem_props.memoryHeapCount; ++i) {
+ if (screen->mem_props.memoryHeaps[i].flags &
+ VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
+ size += screen->mem_props.memoryHeaps[i].size;
+ }
return (int)(size >> 20);
}