From 692aed055174a5aaa7709c4ae0cf3b487bb609ba Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 30 Apr 2019 21:11:44 +0200 Subject: [PATCH] - add VulkanQueryPool::getResults --- src/rendering/vulkan/system/vk_objects.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rendering/vulkan/system/vk_objects.h b/src/rendering/vulkan/system/vk_objects.h index 3ca97f7bf..419ea3295 100644 --- a/src/rendering/vulkan/system/vk_objects.h +++ b/src/rendering/vulkan/system/vk_objects.h @@ -210,6 +210,8 @@ public: void SetDebugName(const char *name) { device->SetDebugObjectName(name, (uint64_t)pool, VK_OBJECT_TYPE_QUERY_POOL); } + bool getResults(uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *data, VkDeviceSize stride, VkQueryResultFlags flags); + VulkanDevice *device = nullptr; VkQueryPool pool = VK_NULL_HANDLE; @@ -957,6 +959,14 @@ inline VulkanQueryPool::~VulkanQueryPool() vkDestroyQueryPool(device->device, pool, nullptr); } +inline bool VulkanQueryPool::getResults(uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *data, VkDeviceSize stride, VkQueryResultFlags flags) +{ + VkResult result = vkGetQueryPoolResults(device->device, pool, firstQuery, queryCount, dataSize, data, stride, flags); + if (result != VK_SUCCESS && result != VK_NOT_READY) + I_Error("vkGetQueryPoolResults failed"); + return result == VK_SUCCESS; +} + ///////////////////////////////////////////////////////////////////////////// inline VulkanFramebuffer::VulkanFramebuffer(VulkanDevice *device, VkFramebuffer framebuffer) : device(device), framebuffer(framebuffer)