tests: Re-enable changes to InitState()

The initial series was causing InitState() to be called
twice in tests using VKTriangleTest.

This is a combination of 4 commits:

  tests: Remove InitState from VKTriangleTest

  Revert "Revert "tests: Move device creation from Setup to InitState""
  This reverts commit 5690813b28260c0acbe54ed5f63a66b57d4f3eef.

  Revert "Revert "tests: Enable passing PhysicalDeviceFeatures to InitState""
  This reverts commit 5c61db858c9e83f6a25993ee6262bd5f1a817551.

  Revert "Revert "tests: Change IndependentBlend test to use new InitState parm""
  This reverts commit 24eca2239aab4a76fa2926e5e1fa48d2171c3e6a.
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index f2f3abc..96a3cb6 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -408,7 +408,6 @@
         data.color[i][3] = tri_data[i].a;
     }
 
-    ASSERT_NO_FATAL_FAILURE(InitState());
     ASSERT_NO_FATAL_FAILURE(InitViewport());
 
     VkConstantBufferObj constantBuffer(m_device, bufSize * 2, sizeof(float),
@@ -3430,6 +3429,7 @@
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
         "FreeCommandBuffers is attempting to free Command Buffer");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkCommandPool command_pool_one;
     VkCommandPool command_pool_two;
 
@@ -3855,6 +3855,7 @@
                      "attempt to submit them on a queue created in a different "
                      "queue family.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // This test is meaningless unless we have multiple queue families
     auto queue_family_properties = m_device->phy().queue_properties();
     if (queue_family_properties.size() < 2) {
@@ -4367,58 +4368,41 @@
     TEST_DESCRIPTION("Generate INDEPENDENT_BLEND by disabling independent "
                      "blend and then specifying different blend states for two "
                      "attachements");
-    ASSERT_NO_FATAL_FAILURE(InitState());
-
-    m_errorMonitor->SetDesiredFailureMsg(
-        VK_DEBUG_REPORT_ERROR_BIT_EXT,
-        "Invalid Pipeline CreateInfo: If independent blend feature not "
-        "enabled, all elements of pAttachments must be identical");
     VkPhysicalDeviceFeatures features = {};
     features.independentBlend = VK_FALSE;
-    std::vector<const char *> extension_names;
-    VkDeviceObj noib_device(0, gpu(), extension_names, &features);
+    ASSERT_NO_FATAL_FAILURE(InitState(&features));
 
-    VkCommandPool cmd_pool;
-    VkCommandPoolCreateInfo pool_create_info{};
-    pool_create_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
-    pool_create_info.queueFamilyIndex = noib_device.graphics_queue_node_index_;
-    pool_create_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
+    m_errorMonitor->SetDesiredFailureMsg(
+                VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                "Invalid Pipeline CreateInfo: If independent blend feature not "
+                "enabled, all elements of pAttachments must be identical");
 
-    vkCreateCommandPool(noib_device.device(), &pool_create_info, nullptr,
-                        &cmd_pool);
-    {
-        // Need cmd_buffer's destructor to be called before calling DestroyCommandPool
-        VkCommandBufferObj cmd_buffer(&noib_device, cmd_pool);
-        VkDescriptorSetObj descriptorSet(&noib_device);
-        descriptorSet.AppendDummy();
-        descriptorSet.CreateVKDescriptorSet(&cmd_buffer);
+    VkDescriptorSetObj descriptorSet(m_device);
+    descriptorSet.AppendDummy();
+    descriptorSet.CreateVKDescriptorSet(m_commandBuffer);
 
-        VkPipelineObj pipeline(&noib_device);
+    VkPipelineObj pipeline(m_device);
+    VkRenderpassObj renderpass(m_device);
+    VkShaderObj vs(m_device, bindStateVertShaderText,
+                   VK_SHADER_STAGE_VERTEX_BIT, this);
+    pipeline.AddShader(&vs);
 
-        VkRenderpassObj renderpass(&noib_device);
-
-        VkShaderObj vs(&noib_device, bindStateVertShaderText,
-                       VK_SHADER_STAGE_VERTEX_BIT, this);
-
-        pipeline.AddShader(&vs);
-
-        VkPipelineColorBlendAttachmentState att_state1 = {}, att_state2 = {};
-        att_state1.dstAlphaBlendFactor = VK_BLEND_FACTOR_CONSTANT_COLOR;
-        att_state1.blendEnable = VK_TRUE;
-        att_state2.dstAlphaBlendFactor = VK_BLEND_FACTOR_CONSTANT_COLOR;
-        att_state2.blendEnable = VK_FALSE;
-        pipeline.AddColorAttachment(0, &att_state1);
-        pipeline.AddColorAttachment(1, &att_state2);
-        pipeline.CreateVKPipeline(descriptorSet.GetPipelineLayout(),
-                                  renderpass.handle());
-        m_errorMonitor->VerifyFound();
-    }
-    vkDestroyCommandPool(noib_device.device(), cmd_pool, NULL);
+    VkPipelineColorBlendAttachmentState att_state1 = {}, att_state2 = {};
+    att_state1.dstAlphaBlendFactor = VK_BLEND_FACTOR_CONSTANT_COLOR;
+    att_state1.blendEnable = VK_TRUE;
+    att_state2.dstAlphaBlendFactor = VK_BLEND_FACTOR_CONSTANT_COLOR;
+    att_state2.blendEnable = VK_FALSE;
+    pipeline.AddColorAttachment(0, &att_state1);
+    pipeline.AddColorAttachment(1, &att_state2);
+    pipeline.CreateVKPipeline(descriptorSet.GetPipelineLayout(),
+                              renderpass.handle());
+    m_errorMonitor->VerifyFound();
 }
 
 TEST_F(VkLayerTest, RenderPassDepthStencilAttachmentUnused) {
     TEST_DESCRIPTION("Specify no depth attachement in renderpass then specify "
                      "depth attachments in subpass");
+    ASSERT_NO_FATAL_FAILURE(InitState());
 
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -5139,6 +5123,7 @@
         "Wait on a event then set it after the wait has been submitted.");
 
     m_errorMonitor->ExpectSuccess();
+    ASSERT_NO_FATAL_FAILURE(InitState());
 
     VkEvent event;
     VkEventCreateInfo event_create_info{};
@@ -5203,6 +5188,7 @@
     TEST_DESCRIPTION(
         "Issue a query on a secondary command buffery and copy it on a primary.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
@@ -5334,6 +5320,7 @@
     TEST_DESCRIPTION(
         "Issue a query and copy from it on a second command buffer.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
@@ -5448,6 +5435,7 @@
 
     m_errorMonitor->ExpectSuccess();
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkEvent event;
     VkEventCreateInfo event_create_info{};
     event_create_info.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
@@ -5498,10 +5486,9 @@
         vkQueueSubmit(queue, 1, &submit_info, VK_NULL_HANDLE);
     }
     {
-        m_errorMonitor->SetDesiredFailureMsg(
-            VK_DEBUG_REPORT_ERROR_BIT_EXT, "Cannot call vkSetEvent() on event "
-                                           "0x1 that is already in use by a "
-                                           "command buffer.");
+        m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                                             "that is already in use by a "
+                                             "command buffer.");
         vkSetEvent(m_device->device(), event);
         m_errorMonitor->VerifyFound();
     }
@@ -5596,6 +5583,7 @@
     TEST_DESCRIPTION("Two command buffers, each in a separate QueueSubmit call "
         "submitted on separate queues followed by a QueueWaitIdle.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
@@ -5703,6 +5691,7 @@
                      "submitted on separate queues, the second having a fence"
                      "followed by a QueueWaitIdle.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
@@ -5818,6 +5807,7 @@
         "submitted on separate queues, the second having a fence"
         "followed by two consecutive WaitForFences calls on the same fence.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
@@ -5926,6 +5916,8 @@
 }
 
 TEST_F(VkLayerTest, TwoQueuesEnsureCorrectRetirementWithWorkStolen) {
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2)) {
         printf("Test requires two queues, skipping\n");
@@ -6012,12 +6004,14 @@
                      "submitted on separate queues, the second having a fence, "
                      "followed by a WaitForFences call.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if ((m_device->queue_props.empty()) ||
         (m_device->queue_props[0].queueCount < 2))
         return;
 
     m_errorMonitor->ExpectSuccess();
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkFence fence;
     VkFenceCreateInfo fence_create_info{};
     fence_create_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
@@ -6129,6 +6123,7 @@
 
     m_errorMonitor->ExpectSuccess();
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkFence fence;
     VkFenceCreateInfo fence_create_info{};
     fence_create_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
@@ -6235,6 +6230,7 @@
 
     m_errorMonitor->ExpectSuccess();
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkFence fence;
     VkFenceCreateInfo fence_create_info{};
     fence_create_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
@@ -6337,6 +6333,7 @@
 
     m_errorMonitor->ExpectSuccess();
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkFence fence;
     VkFenceCreateInfo fence_create_info{};
     fence_create_info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
@@ -6432,6 +6429,7 @@
     TEST_DESCRIPTION(
         "Two command buffers each in a separate SubmitInfo sent in a single "
         "QueueSubmit call followed by a WaitForFences call.");
+    ASSERT_NO_FATAL_FAILURE(InitState());
 
     m_errorMonitor->ExpectSuccess();
 
@@ -6541,6 +6539,7 @@
         "Run a simple draw calls to validate failure when Depth Bias dynamic "
         "state is required but not correctly bound.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic depth bias
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6555,6 +6554,7 @@
         "Run a simple draw calls to validate failure when Line Width dynamic "
         "state is required but not correctly bound.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic line width
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6569,6 +6569,7 @@
         "Run a simple draw calls to validate failure when Viewport dynamic "
         "state is required but not correctly bound.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic viewport state
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6583,6 +6584,7 @@
         "Run a simple draw calls to validate failure when Scissor dynamic "
         "state is required but not correctly bound.");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic scissor state
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6596,6 +6598,8 @@
     TEST_DESCRIPTION(
         "Run a simple draw calls to validate failure when Blend Constants "
         "dynamic state is required but not correctly bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic blend constant state
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6609,6 +6613,8 @@
     TEST_DESCRIPTION(
         "Run a simple draw calls to validate failure when Depth Bounds dynamic "
         "state is required but not correctly bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     if (!m_device->phy().features().depthBounds) {
         printf("Device does not support depthBounds test; skipped.\n");
         return;
@@ -6626,6 +6632,8 @@
     TEST_DESCRIPTION(
         "Run a simple draw calls to validate failure when Stencil Read dynamic "
         "state is required but not correctly bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic stencil read mask
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6639,6 +6647,8 @@
     TEST_DESCRIPTION(
         "Run a simple draw calls to validate failure when Stencil Write dynamic"
         " state is required but not correctly bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic stencil write mask
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6652,6 +6662,8 @@
     TEST_DESCRIPTION(
         "Run a simple draw calls to validate failure when Stencil Ref dynamic "
         "state is required but not correctly bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     // Dynamic stencil reference
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
@@ -6663,6 +6675,8 @@
 
 TEST_F(VkLayerTest, IndexBufferNotBound) {
     TEST_DESCRIPTION("Run an indexed draw call without an index buffer bound.");
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
         "Index buffer object not bound to this command buffer when Indexed ");
@@ -6843,6 +6857,8 @@
 TEST_F(VkLayerTest, InvalidDescriptorPool) {
     // Attempt to clear Descriptor Pool with bad object.
     // ObjectTracker should catch this.
+
+    ASSERT_NO_FATAL_FAILURE(InitState());
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
                                          "Invalid Descriptor Pool Object 0xbaad6001");
     uint64_t fake_pool_handle = 0xbaad6001;
@@ -6906,7 +6922,7 @@
     VkDescriptorSetLayout bad_layout = reinterpret_cast<VkDescriptorSetLayout &>(fake_layout_handle);
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
                                          "Invalid Descriptor Set Layout Object 0xbaad6001");
-
+    ASSERT_NO_FATAL_FAILURE(InitState());
     VkPipelineLayout pipeline_layout;
     VkPipelineLayoutCreateInfo plci = {};
     plci.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
@@ -12059,6 +12075,7 @@
 TEST_F(VkLayerTest, MissingClearAttachment) {
     TEST_DESCRIPTION("Points to a wrong colorAttachment index in a VkClearAttachment "
                      "structure passed to vkCmdClearAttachments");
+    ASSERT_NO_FATAL_FAILURE(InitState());
     m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
                                          "vkCmdClearAttachments() attachment index 1 not found in attachment "
                                          "reference array of active subpass 0");
@@ -12291,6 +12308,7 @@
 TEST_F(VkLayerTest, MismatchCountQueueCreateRequestedFeature) {
     TEST_DESCRIPTION("Use an invalid count in a vkEnumeratePhysicalDevices call."
                      "Use invalid Queue Family Index in vkCreateDevice");
+    ASSERT_NO_FATAL_FAILURE(InitState());
 
     const char *mismatch_count_message =
             "Call to vkEnumeratePhysicalDevices() "
@@ -15824,6 +15842,7 @@
 
     TEST_DESCRIPTION("Exceed the limits of image format ");
 
+    ASSERT_NO_FATAL_FAILURE(InitState());
     m_errorMonitor->SetDesiredFailureMsg(
         VK_DEBUG_REPORT_ERROR_BIT_EXT,
         "CreateImage extents exceed allowable limits for format");