| 74 | |
| 75 | |
| 76 | TimerQueryHandle Device::createTimerQuery(void) |
| 77 | { |
| 78 | if (!m_TimerQueryPool) |
| 79 | { |
| 80 | std::lock_guard lockGuard(m_Mutex); |
| 81 | |
| 82 | if (!m_TimerQueryPool) |
| 83 | { |
| 84 | // set up the timer query pool on first use |
| 85 | auto poolInfo = vk::QueryPoolCreateInfo() |
| 86 | .setQueryType(vk::QueryType::eTimestamp) |
| 87 | .setQueryCount(uint32_t(m_TimerQueryAllocator.getCapacity()) * 2); // use 2 Vulkan queries per 1 TimerQuery |
| 88 | |
| 89 | const vk::Result res = m_Context.device.createQueryPool(&poolInfo, m_Context.allocationCallbacks, &m_TimerQueryPool); |
| 90 | CHECK_VK_FAIL(res) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | int queryIndex = m_TimerQueryAllocator.allocate(); |
| 95 | |
| 96 | if (queryIndex < 0) |
| 97 | { |
| 98 | m_Context.error("Insufficient query pool space, increase Device::numTimerQueries"); |
| 99 | return nullptr; |
| 100 | } |
| 101 | |
| 102 | TimerQuery* query = new TimerQuery(m_TimerQueryAllocator); |
| 103 | query->beginQueryIndex = queryIndex * 2; |
| 104 | query->endQueryIndex = queryIndex * 2 + 1; |
| 105 | |
| 106 | return TimerQueryHandle::Create(query); |
| 107 | } |
| 108 | |
| 109 | TimerQuery::~TimerQuery() |
| 110 | { |
nothing calls this directly
no test coverage detected