tests: Fix commandpool unexpected error
InvalidCmdBufferDescriptorSetImageSamplerDestroyed
Change-Id: I6e1fea456492012df13c18e982d39fc54e53979c
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 73ea19d..7a64082 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -5331,7 +5331,7 @@
"each respectively destroyed and then attempting to "
"submit associated cmd buffers. Attempt to destroy a "
"DescriptorSet that is in use.");
- ASSERT_NO_FATAL_FAILURE(InitState());
+ ASSERT_NO_FATAL_FAILURE(InitState(nullptr, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT));
ASSERT_NO_FATAL_FAILURE(InitViewport());
ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
@@ -5342,6 +5342,7 @@
VkDescriptorPoolCreateInfo ds_pool_ci = {};
ds_pool_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
ds_pool_ci.pNext = NULL;
+ ds_pool_ci.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
ds_pool_ci.maxSets = 1;
ds_pool_ci.poolSizeCount = 1;
ds_pool_ci.pPoolSizes = &ds_type_count;
@@ -5543,8 +5544,13 @@
// Now re-update descriptor with valid sampler and delete image
img_info.sampler = sampler2;
vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
+
+ VkCommandBufferBeginInfo info = {};
+ info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
+ info.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
+
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " that is invalid because bound image ");
- m_commandBuffer->BeginCommandBuffer();
+ m_commandBuffer->BeginCommandBuffer(&info);
m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo);
vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
@@ -5566,7 +5572,7 @@
// Now update descriptor to be valid, but then free descriptor
img_info.imageView = view2;
vkUpdateDescriptorSets(m_device->device(), 1, &descriptor_write, 0, NULL);
- m_commandBuffer->BeginCommandBuffer();
+ m_commandBuffer->BeginCommandBuffer(&info);
m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo);
vkCmdBindPipeline(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
vkCmdBindDescriptorSets(m_commandBuffer->GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1,
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 18abc83..a2bf1a1 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -204,7 +204,7 @@
}
}
-void VkRenderFramework::InitState(VkPhysicalDeviceFeatures *features) {
+void VkRenderFramework::InitState(VkPhysicalDeviceFeatures *features, const VkCommandPoolCreateFlags flags) {
VkResult U_ASSERT_ONLY err;
m_device = new VkDeviceObj(0, objs[0], device_extension_names, features);
@@ -235,7 +235,7 @@
VkCommandPoolCreateInfo cmd_pool_info;
cmd_pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, cmd_pool_info.pNext = NULL,
cmd_pool_info.queueFamilyIndex = m_device->graphics_queue_node_index_;
- cmd_pool_info.flags = 0;
+ cmd_pool_info.flags = flags;
err = vkCreateCommandPool(device(), &cmd_pool_info, NULL, &m_commandPool);
assert(!err);
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index e31eb57..f58f02d 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -76,7 +76,7 @@
void ShutdownFramework();
void GetPhysicalDeviceFeatures(VkPhysicalDeviceFeatures *features);
- void InitState(VkPhysicalDeviceFeatures *features = nullptr);
+ void InitState(VkPhysicalDeviceFeatures *features = nullptr, const VkCommandPoolCreateFlags flags = 0);
const VkRenderPassBeginInfo &renderPassBeginInfo() const { return m_renderPassBeginInfo; }