Skip to content

Commit

Permalink
tests: Add regression test for issue 7874
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-lunarg committed Apr 25, 2024
1 parent 33216c2 commit 9911e85
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/unit/query_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,4 +543,32 @@ TEST_F(PositiveQuery, HostQueryResetSuccess) {
query_pool_create_info.queryCount = 1;
vkt::QueryPool query_pool(*m_device, query_pool_create_info);
vk::ResetQueryPoolEXT(device(), query_pool.handle(), 0, 1);
}
}

// https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/7874
TEST_F(PositiveQuery, ReuseSecondaryWithQueryCommand) {
TEST_DESCRIPTION("Regression test for a deadlock when secondary command buffer is reused and records a query command");

RETURN_IF_SKIP(Init());
if (HasZeroTimestampValidBits()) {
GTEST_SKIP() << "Device graphic queue has timestampValidBits of 0, skipping.";
}

vkt::QueryPool query_pool(*m_device, VK_QUERY_TYPE_TIMESTAMP, 1);

vkt::CommandBuffer secondary_buffer(*m_device, m_commandPool, VK_COMMAND_BUFFER_LEVEL_SECONDARY);
secondary_buffer.begin(VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT);
vk::CmdWriteTimestamp(secondary_buffer.handle(), VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, query_pool, 0);
secondary_buffer.end();

m_commandBuffer->begin(VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT);
vk::CmdResetQueryPool(m_commandBuffer->handle(), query_pool, 0, 1);
vk::CmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary_buffer.handle());
m_commandBuffer->end();

m_default_queue->submit(*m_commandBuffer);
// Submit the command buffer again.
m_default_queue->submit(*m_commandBuffer);

m_default_queue->wait();
}

0 comments on commit 9911e85

Please sign in to comment.