Skip to content

Commit

Permalink
tests: Test invalid compositeAlpha
Browse files Browse the repository at this point in the history
  • Loading branch information
ziga-lunarg committed Jan 13, 2025
1 parent a57aaf0 commit 01d7edb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/unit/wsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3620,3 +3620,36 @@ TEST_F(NegativeWsi, MissingPresentModesCreateInfoFifoLatestReadyFeature) {
vkt::Swapchain swapchain(*m_device, swapchain_ci);
m_errorMonitor->VerifyFound();
}

TEST_F(NegativeWsi, UnsupportedCompositeAlpha) {
TEST_DESCRIPTION("Create swapchain with unsupported fifo latest ready present mode");

AddSurfaceExtension();
RETURN_IF_SKIP(Init());
RETURN_IF_SKIP(InitSurface());
InitSwapchainInfo();

VkCompositeAlphaFlagBitsKHR compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
if (m_surface_capabilities.supportedCompositeAlpha & compositeAlpha) {
GTEST_SKIP() << "VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR is supported";
}

VkSwapchainCreateInfoKHR swapchain_ci = vku::InitStructHelper();
swapchain_ci.surface = m_surface.Handle();
swapchain_ci.minImageCount = m_surface_capabilities.minImageCount;
swapchain_ci.imageFormat = m_surface_formats[0].format;
swapchain_ci.imageColorSpace = m_surface_formats[0].colorSpace;
swapchain_ci.imageExtent = {m_surface_capabilities.minImageExtent.width, m_surface_capabilities.minImageExtent.height};
swapchain_ci.imageArrayLayers = 1u;
swapchain_ci.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
swapchain_ci.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
swapchain_ci.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
swapchain_ci.compositeAlpha = compositeAlpha;
swapchain_ci.presentMode = m_surface_non_shared_present_mode;
swapchain_ci.clipped = VK_FALSE;
swapchain_ci.oldSwapchain = 0;

m_errorMonitor->SetDesiredError("VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280");
vkt::Swapchain swapchain(*m_device, swapchain_ci);
m_errorMonitor->VerifyFound();
}

0 comments on commit 01d7edb

Please sign in to comment.