| 21 | class NegativeQuery : public QueryTest {}; |
| 22 | |
| 23 | TEST_F(NegativeQuery, PerformanceCreation) { |
| 24 | TEST_DESCRIPTION("Create performance query without support"); |
| 25 | AddRequiredExtensions(VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME); |
| 26 | AddRequiredFeature(vkt::Feature::performanceCounterQueryPools); |
| 27 | RETURN_IF_SKIP(Init()); |
| 28 | |
| 29 | auto queueFamilyProperties = m_device->Physical().queue_properties_; |
| 30 | uint32_t queueFamilyIndex = queueFamilyProperties.size(); |
| 31 | std::vector<VkPerformanceCounterKHR> counters; |
| 32 | |
| 33 | for (uint32_t idx = 0; idx < queueFamilyProperties.size(); idx++) { |
| 34 | uint32_t nCounters; |
| 35 | |
| 36 | vk::EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(Gpu(), idx, &nCounters, nullptr, nullptr); |
| 37 | if (nCounters == 0) continue; |
| 38 | |
| 39 | counters.resize(nCounters); |
| 40 | for (auto& c : counters) { |
| 41 | c = vku::InitStructHelper(); |
| 42 | } |
| 43 | vk::EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(Gpu(), idx, &nCounters, &counters[0], nullptr); |
| 44 | queueFamilyIndex = idx; |
| 45 | break; |
| 46 | } |
| 47 | |
| 48 | if (counters.empty()) { |
| 49 | GTEST_SKIP() << "No queue reported any performance counter."; |
| 50 | } |
| 51 | |
| 52 | VkQueryPoolPerformanceCreateInfoKHR perf_query_pool_ci = vku::InitStructHelper(); |
| 53 | perf_query_pool_ci.queueFamilyIndex = queueFamilyIndex; |
| 54 | perf_query_pool_ci.counterIndexCount = counters.size(); |
| 55 | std::vector<uint32_t> counterIndices; |
| 56 | for (uint32_t c = 0; c < counters.size(); c++) counterIndices.push_back(c); |
| 57 | perf_query_pool_ci.pCounterIndices = &counterIndices[0]; |
| 58 | VkQueryPoolCreateInfo query_pool_ci = vku::InitStructHelper(); |
| 59 | query_pool_ci.queryType = VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR; |
| 60 | query_pool_ci.queryCount = 1; |
| 61 | |
| 62 | vkt::QueryPool query_pool; |
| 63 | |
| 64 | // Missing pNext |
| 65 | m_errorMonitor->SetDesiredError("VUID-VkQueryPoolCreateInfo-queryType-03222"); |
| 66 | query_pool.Init(*m_device, query_pool_ci); |
| 67 | m_errorMonitor->VerifyFound(); |
| 68 | |
| 69 | query_pool_ci.pNext = &perf_query_pool_ci; |
| 70 | |
| 71 | // Invalid counter indices |
| 72 | counterIndices.push_back(counters.size()); |
| 73 | perf_query_pool_ci.counterIndexCount++; |
| 74 | perf_query_pool_ci.pCounterIndices = counterIndices.data(); |
| 75 | m_errorMonitor->SetDesiredError("VUID-VkQueryPoolPerformanceCreateInfoKHR-pCounterIndices-03321"); |
| 76 | query_pool.Init(*m_device, query_pool_ci); |
| 77 | m_errorMonitor->VerifyFound(); |
| 78 | perf_query_pool_ci.counterIndexCount--; |
| 79 | counterIndices.pop_back(); |
| 80 |
nothing calls this directly
no test coverage detected