tests: GH428 Addition of tests for sync validation cases
authorMark Mueller <markm@lunarg.com>
Wed, 24 Aug 2016 16:28:05 +0000 (10:28 -0600)
committerMark Mueller <markm@lunarg.com>
Wed, 31 Aug 2016 16:26:30 +0000 (10:26 -0600)
This branch adds tests that challenge the validation layer on
various synchronization validation cases including:

4) QUEUE_FORWARD_PROGRESS - call vkQueueSubmit with a semaphore
    that has already been signaled
    QueueForwardProgressFenceWait

Change-Id: Ida7fafe4adbeac95356647b96dfd737f7cf13cf1

tests/layer_validation_tests.cpp

index 47cada4..3d60a33 100644 (file)
@@ -13902,6 +13902,44 @@ TEST_F(VkLayerTest, InUseDestroyedSignaled) {
     vkDestroyPipelineLayout(m_device->device(), pipeline_layout, nullptr);
 }
 
+TEST_F(VkLayerTest, QueueForwardProgress) {
+    TEST_DESCRIPTION("Call VkQueueSubmit with a semaphore that is already "
+                     "signaled but not waited on by the queue.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
+    ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
+
+    const char *queue_forward_progress_message =
+            " that has already been signaled but not waited on by queue 0x";
+
+    BeginCommandBuffer();
+    EndCommandBuffer();
+
+    VkSemaphoreCreateInfo semaphore_create_info = {};
+    semaphore_create_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+    VkSemaphore semaphore;
+    ASSERT_VK_SUCCESS(vkCreateSemaphore(m_device->device(), &semaphore_create_info,
+                                        nullptr, &semaphore));
+    VkSubmitInfo submit_info = {};
+    submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+    submit_info.commandBufferCount = 1;
+    submit_info.pCommandBuffers =&m_commandBuffer->handle();
+    submit_info.signalSemaphoreCount = 1;
+    submit_info.pSignalSemaphores = &semaphore;
+    vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
+    m_errorMonitor->SetDesiredFailureMsg(0, "");
+    vkResetCommandBuffer(m_commandBuffer->handle(), 0);
+    BeginCommandBuffer();
+    EndCommandBuffer();
+    m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                                         queue_forward_progress_message);
+    vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
+    m_errorMonitor->VerifyFound();
+
+    m_errorMonitor->SetDesiredFailureMsg(0, "");
+    vkDestroySemaphore(m_device->device(), semaphore, nullptr);
+}
+
 TEST_F(VkLayerTest, FramebufferIncompatible) {
     TEST_DESCRIPTION("Bind a secondary command buffer with with a framebuffer "
                      "that does not match the framebuffer for the active "