tests: Finalize tests for rerecorded case
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 0616504..9592df7 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3096,12 +3096,19 @@
return false;
}
+static char const * GetCauseStr(VK_OBJECT obj) {
+ if (obj.type == kVulkanObjectTypeDescriptorSet)
+ return "destroyed or updated";
+ if (obj.type == kVulkanObjectTypeCommandBuffer)
+ return "destroyed or rerecorded";
+ return "destroyed";
+}
+
static bool ReportInvalidCommandBuffer(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, const char *call_source) {
bool skip = false;
for (auto obj : cb_state->broken_bindings) {
const char *type_str = object_string[obj.type];
- // Descriptor sets are a special case that can be either destroyed or updated to invalidate a CB
- const char *cause_str = (obj.type == kVulkanObjectTypeDescriptorSet) ? "destroyed or updated" : "destroyed";
+ const char *cause_str = GetCauseStr(obj);
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
HandleToUint64(cb_state->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"You are adding %s to command buffer 0x%p that is invalid because bound %s 0x%" PRIxLEAST64 " was %s.",
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 054ffe4..1d7a7f8 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -7543,10 +7543,10 @@
vkFreeCommandBuffers(m_device->device(), m_commandPool->handle(), 1, &draw_cmd);
}
-TEST_F(VkLayerTest, SecondaryCommandBufferRerecorded) {
+TEST_F(VkLayerTest, SecondaryCommandBufferRerecordedExplicitReset) {
ASSERT_NO_FATAL_FAILURE(Init());
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Dummy");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "was destroyed or rerecorded");
// A pool we can reset in.
VkCommandPoolObj pool(m_device, m_device->graphics_queue_node_index_,
@@ -7561,15 +7561,36 @@
vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle());
// rerecording of secondary
- secondary.reset(); // masks our ability to catch this!
+ secondary.reset(); // explicit reset here.
secondary.begin();
secondary.end();
vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle());
- m_commandBuffer->end();
+ m_errorMonitor->VerifyFound();
+}
- // submit
- m_commandBuffer->QueueCommandBuffer(false);
+TEST_F(VkLayerTest, SecondaryCommandBufferRerecordedNoReset) {
+ ASSERT_NO_FATAL_FAILURE(Init());
+
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "was destroyed or rerecorded");
+
+ // A pool we can reset in.
+ VkCommandPoolObj pool(m_device, m_device->graphics_queue_node_index_,
+ VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
+ VkCommandBufferObj secondary(m_device, &pool,
+ VK_COMMAND_BUFFER_LEVEL_SECONDARY);
+
+ secondary.begin();
+ secondary.end();
+
+ m_commandBuffer->begin();
+ vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle());
+
+ // rerecording of secondary
+ secondary.begin(); // implicit reset in begin
+ secondary.end();
+
+ vkCmdExecuteCommands(m_commandBuffer->handle(), 1, &secondary.handle());
m_errorMonitor->VerifyFound();
}