From 24bf0c685ccba8298a98a7b34ee8a99b519de5c0 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 11 Jun 2022 16:34:52 +0200 Subject: [PATCH] Remove GetVulkanFrameBuffer() so nobody is tempted to call it in the future --- .../rendering/vulkan/system/vk_framebuffer.cpp | 15 +++++++++++---- .../rendering/vulkan/system/vk_framebuffer.h | 2 -- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/common/rendering/vulkan/system/vk_framebuffer.cpp b/src/common/rendering/vulkan/system/vk_framebuffer.cpp index 8e94c382a3..02f7aa252a 100644 --- a/src/common/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/common/rendering/vulkan/system/vk_framebuffer.cpp @@ -69,10 +69,17 @@ EXTERN_CVAR(Bool, cl_capfps) CCMD(vk_memstats) { - VmaStats stats = {}; - vmaCalculateStats(GetVulkanFrameBuffer()->device->allocator, &stats); - Printf("Allocated objects: %d, used bytes: %d MB\n", (int)stats.total.allocationCount, (int)stats.total.usedBytes / (1024 * 1024)); - Printf("Unused range count: %d, unused bytes: %d MB\n", (int)stats.total.unusedRangeCount, (int)stats.total.unusedBytes / (1024 * 1024)); + if (screen->IsVulkan()) + { + VmaStats stats = {}; + vmaCalculateStats(static_cast(screen)->device->allocator, &stats); + Printf("Allocated objects: %d, used bytes: %d MB\n", (int)stats.total.allocationCount, (int)stats.total.usedBytes / (1024 * 1024)); + Printf("Unused range count: %d, unused bytes: %d MB\n", (int)stats.total.unusedRangeCount, (int)stats.total.unusedBytes / (1024 * 1024)); + } + else + { + Printf("Vulkan is not the current render device\n"); + } } VulkanFrameBuffer::VulkanFrameBuffer(void *hMonitor, bool fullscreen, VulkanDevice *dev) : diff --git a/src/common/rendering/vulkan/system/vk_framebuffer.h b/src/common/rendering/vulkan/system/vk_framebuffer.h index 40ed756334..e203a08c9b 100644 --- a/src/common/rendering/vulkan/system/vk_framebuffer.h +++ b/src/common/rendering/vulkan/system/vk_framebuffer.h @@ -110,5 +110,3 @@ private: bool mVSync = false; }; - -inline VulkanFrameBuffer *GetVulkanFrameBuffer() { return static_cast(screen); }