Skip to content

Commit

Permalink
Vulkan: Use surfaceless queries with headless EGL configs
Browse files Browse the repository at this point in the history
Bug: angleproject:389342064
Change-Id: If5ec101f5ef5135febe3fe12d5c309fe2a35f07c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6169254
Reviewed-by: Charlie Lao <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
  • Loading branch information
ShabbyX authored and Angle LUCI CQ committed Jan 24, 2025
1 parent d7ea4b2 commit 8c298ec
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/libANGLE/renderer/vulkan/linux/headless/DisplayVkHeadless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ SurfaceImpl *DisplayVkHeadless::createWindowSurfaceVk(const egl::SurfaceState &s

egl::ConfigSet DisplayVkHeadless::generateConfigs()
{
std::vector<GLenum> kColorFormats = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8};
std::vector<GLenum> kDesiredColorFormats = {GL_RGB10_A2};
std::vector<GLenum> kColorFormats;
std::vector<GLenum> kDesiredColorFormats = {GL_RGBA8, GL_BGRA8_EXT, GL_RGB565, GL_RGB8,
GL_RGB10_A2};

for (GLenum glFormat : kDesiredColorFormats)
{
Expand All @@ -47,13 +48,23 @@ 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 |
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT |
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);
}
}
Expand Down

0 comments on commit 8c298ec

Please sign in to comment.