MCPcopy Create free account
hub / github.com/NVIDIA-RTX/NVRHI / createTimerQuery

Method createTimerQuery

src/vulkan/vulkan-queries.cpp:76–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

allocateMethod · 0.80
getCapacityMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected