diff --git a/src/libANGLE/renderer/vulkan/linux/headless/DisplayVkHeadless.cpp b/src/libANGLE/renderer/vulkan/linux/headless/DisplayVkHeadless.cpp index eba0de23b05..c56977c6b5a 100644 --- a/src/libANGLE/renderer/vulkan/linux/headless/DisplayVkHeadless.cpp +++ b/src/libANGLE/renderer/vulkan/linux/headless/DisplayVkHeadless.cpp @@ -37,8 +37,9 @@ SurfaceImpl *DisplayVkHeadless::createWindowSurfaceVk(const egl::SurfaceState &s egl::ConfigSet DisplayVkHeadless::generateConfigs() { - std::vector kColorFormats = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8}; - std::vector kDesiredColorFormats = {GL_RGB10_A2}; + std::vector kColorFormats; + std::vector kDesiredColorFormats = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8, + GL_RGB10_A2}; for (GLenum glFormat : kDesiredColorFormats) { @@ -47,6 +48,7 @@ egl::ConfigSet DisplayVkHeadless::generateConfigs() ASSERT(vkFormat != VK_FORMAT_UNDEFINED); angle::FormatID actualFormatID = vk::GetFormatIDFromVkFormat(vkFormat); + if (mRenderer->hasImageFormatFeatureBits( actualFormatID, VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | @@ -54,6 +56,15 @@ egl::ConfigSet DisplayVkHeadless::generateConfigs() VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) { + // If VK_GOOGLE_surfaceless_query is present, additionally check the surface + // capabilities with this format. If the extension is not supported, advertise the + // format anyway and hope for the best. + if (getFeatures().supportsSurfacelessQueryExtension.enabled && + !isConfigFormatSupported(vkFormat)) + { + continue; + } + kColorFormats.push_back(glFormat); } }