tests: Added tests for unrecorded prim/sec CBs
Also updated error DB with new test name (ExecuteUnrecordedCBs).
Change-Id: I5bb65b9a9b6bf93cbca5eceb66b2c7f7937ea313
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index dbb51fe..455b843 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -18962,6 +18962,53 @@
}
}
+TEST_F(VkLayerTest, ExecuteUnrecordedCBs) {
+ TEST_DESCRIPTION(
+ "Attempt vkCmdExecuteCommands and then QueueSubmit with an unrecorded secondary and primary command buffer, respectively");
+
+ ASSERT_NO_FATAL_FAILURE(Init());
+ ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00155);
+ // Allocate a secondary command buffer
+ VkCommandBufferAllocateInfo command_buffer_allocate_info = {};
+ command_buffer_allocate_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
+ command_buffer_allocate_info.commandPool = m_commandPool->handle();
+ command_buffer_allocate_info.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY;
+ command_buffer_allocate_info.commandBufferCount = 1;
+ VkCommandBuffer secondary_command_buffer;
+ ASSERT_VK_SUCCESS(vkAllocateCommandBuffers(m_device->device(), &command_buffer_allocate_info, &secondary_command_buffer));
+ VkCommandBufferBeginInfo command_buffer_begin_info = {};
+ command_buffer_begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
+ command_buffer_begin_info.flags =
+ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
+ command_buffer_begin_info.pInheritanceInfo = nullptr;
+
+ // Now update primary cmd buffer to execute unrecorded secondary
+ VkResult err = vkBeginCommandBuffer(m_commandBuffer->handle(), &command_buffer_begin_info);
+ ASSERT_VK_SUCCESS(err);
+ vkCmdBeginRenderPass(m_commandBuffer->handle(), &renderPassBeginInfo(), VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS);
+ vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary_command_buffer);
+ vkCmdEndRenderPass(m_commandBuffer->handle());
+ err = vkEndCommandBuffer(m_commandBuffer->handle());
+ ASSERT_VK_SUCCESS(err);
+ m_errorMonitor->VerifyFound();
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00134);
+ // Allocate a primary command buffer
+ command_buffer_allocate_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
+ command_buffer_allocate_info.commandBufferCount = 1;
+ VkCommandBuffer primary_command_buffer;
+ ASSERT_VK_SUCCESS(vkAllocateCommandBuffers(m_device->device(), &command_buffer_allocate_info, &primary_command_buffer));
+
+ // And submit the unrecorded command buffer
+ VkSubmitInfo submit_info = {};
+ submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submit_info.commandBufferCount = 1;
+ submit_info.pCommandBuffers = &primary_command_buffer;
+ err = vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
+ m_errorMonitor->VerifyFound();
+}
+
// WSI Enabled Tests
//
#if 0