Skip to content

Commit

Permalink
layers: Clarify Query Reset Message
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Jul 1, 2024
1 parent 2d13d34 commit 949fe72
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
13 changes: 7 additions & 6 deletions layers/core_checks/cc_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,12 +787,13 @@ bool CoreChecks::VerifyQueryIsReset(const vvl::CommandBuffer &cb_state, const Qu
: unexpected_caller_vuid;
assert(strcmp(vuid, unexpected_caller_vuid) != 0);

skip |= state_data.LogError(vuid, objlist, loc,
"%s and query %" PRIu32
": query not reset. "
"After query pool creation, each query must be reset before it is used. "
"Queries must also be reset between uses.",
state_data.FormatHandle(query_obj.pool).c_str(), query_obj.slot);
skip |= state_data.LogError(
vuid, objlist, loc,
"%s and query %" PRIu32
": query not reset. "
"After query pool creation, each query must be reset (with vkCmdResetQueryPool or vkResetQueryPool) before it is used. "
"Queries must also be reset between uses.",
state_data.FormatHandle(query_obj.pool).c_str(), query_obj.slot);
}

return skip;
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2536,4 +2536,24 @@ TEST_F(NegativeQuery, PerfQueryQueueFamilyIndex) {
m_errorMonitor->VerifyFound();
cb.end();
vk::ReleaseProfilingLockKHR(*m_device);
}

TEST_F(NegativeQuery, NoInitReset) {
AddRequiredFeature(vkt::Feature::pipelineStatisticsQuery);
RETURN_IF_SKIP(Init());
InitRenderTarget();

VkQueryPoolCreateInfo qpci = vkt::QueryPool::create_info(VK_QUERY_TYPE_PIPELINE_STATISTICS, 1);
qpci.pipelineStatistics = VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT;
vkt::QueryPool query_pool(*m_device, qpci);

m_commandBuffer->begin();
vk::CmdBeginQuery(m_commandBuffer->handle(), query_pool.handle(), 0, 0);
vk::CmdEndQuery(m_commandBuffer->handle(), query_pool.handle(), 0);
m_commandBuffer->end();

m_errorMonitor->SetDesiredError("VUID-vkCmdBeginQuery-None-00807");
m_default_queue->Submit(*m_commandBuffer);
m_default_queue->Wait();
m_errorMonitor->VerifyFound();
}

0 comments on commit 949fe72

Please sign in to comment.