diff --git a/tests/unit/best_practices_positive.cpp b/tests/unit/best_practices_positive.cpp index 14c6170cb04..ac234392eca 100644 --- a/tests/unit/best_practices_positive.cpp +++ b/tests/unit/best_practices_positive.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2015-2024 The Khronos Group Inc. - * Copyright (c) 2015-2024 Valve Corporation - * Copyright (c) 2015-2024 LunarG, Inc. - * Copyright (c) 2015-2024 Google, Inc. + * Copyright (c) 2015-2025 The Khronos Group Inc. + * Copyright (c) 2015-2025 Valve Corporation + * Copyright (c) 2015-2025 LunarG, Inc. + * Copyright (c) 2015-2025 Google, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -423,3 +423,36 @@ TEST_F(VkPositiveBestPracticesLayerTest, CreateFifoRelaxedSwapchain) { m_errorMonitor->SetAllowedFailureMsg("VUID-VkSwapchainCreateInfoKHR-presentMode-02839"); m_swapchain.Init(*m_device, swapchain_create_info); } + +TEST_F(VkPositiveBestPracticesLayerTest, ResetCommandPool) { + TEST_DESCRIPTION("Destroy event that was set in a command buffer"); + + RETURN_IF_SKIP(InitBestPracticesFramework()); + void *pNext = nullptr; + VkPhysicalDevicePortabilitySubsetFeaturesKHR portability_subset_features = vku::InitStructHelper(); + if (IsExtensionsEnabled(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)) { + VkPhysicalDevicePortabilitySubsetFeaturesKHR portability_subset_features = vku::InitStructHelper(); + GetPhysicalDeviceFeatures2(portability_subset_features); + if (!portability_subset_features.events) { + GTEST_SKIP() << "VkPhysicalDevicePortabilitySubsetFeaturesKHR::events not supported"; + } + pNext = &portability_subset_features; + } + RETURN_IF_SKIP(InitState(nullptr, pNext)); + + { + vkt::Event event1(*m_device); + m_command_buffer.Begin(); + event1.CmdSet(m_command_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT); + m_command_buffer.End(); + m_default_queue->Submit(m_command_buffer); + m_default_queue->Wait(); + } + + vkt::Event event2(*m_device); + m_command_buffer.Begin(); + event2.CmdSet(m_command_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT); + m_command_buffer.End(); + m_default_queue->Submit(m_command_buffer); + m_default_queue->Wait(); +}