rpcsx/rpcs3/Emu/RSX/VK/vkutils/query_pool.hpp

47 lines
870 B
C++
Raw Normal View History

2020-12-24 11:49:08 +01:00
#pragma once
#include "../VulkanAPI.h"
#include "../../rsx_utils.h"
2025-02-11 03:00:37 +01:00
#include "shared.h"
2020-12-24 11:49:08 +01:00
namespace vk
{
class query_pool : public rsx::ref_counted
{
VkQueryPool m_query_pool;
VkDevice m_device;
u32 m_size;
2020-12-24 11:49:08 +01:00
public:
query_pool(VkDevice dev, VkQueryType type, u32 size)
: m_query_pool(VK_NULL_HANDLE)
, m_device(dev)
, m_size(size)
2020-12-24 11:49:08 +01:00
{
VkQueryPoolCreateInfo info{};
info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
info.queryType = type;
info.queryCount = size;
CHECK_RESULT(vkCreateQueryPool(dev, &info, nullptr, &m_query_pool));
2020-12-24 11:49:08 +01:00
// Take 'size' references on this object
ref_count.release(static_cast<s32>(size));
}
~query_pool()
{
vkDestroyQueryPool(m_device, m_query_pool, nullptr);
}
operator VkQueryPool()
{
return m_query_pool;
}
inline u32 size() const
{
return m_size;
}
2020-12-24 11:49:08 +01:00
};
}