Skip to content

Commit

Permalink
Vulkan: Bugfix in FindSupportedFormat
Browse files Browse the repository at this point in the history
Account for vendors that do not support any image fallback formats

Bug: angleproject:42261363
Change-Id: I2a6b1a724e52d9fa75444ff154986b49de612d32
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5646126
Commit-Queue: mohan maiya <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
  • Loading branch information
Mohan Maiya authored and Angle LUCI CQ committed Jun 21, 2024
1 parent 48969c9 commit 6f33edd
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/libANGLE/renderer/vulkan/vk_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,18 @@ int FindSupportedFormat(vk::Renderer *renderer,
SupportTest hasSupport)
{
ASSERT(numInfo > 0);
const int last = numInfo - 1;

for (int i = static_cast<int>(skip); i < last; ++i)
for (int i = static_cast<int>(skip); i < numInfo; ++i)
{
ASSERT(info[i].format != angle::FormatID::NONE);
if (hasSupport(renderer, info[i].format))
{
return i;
}
}

if (skip > 0 && !hasSupport(renderer, info[last].format))
{
// We couldn't find a valid fallback, try again without skip
return FindSupportedFormat(renderer, info, 0, numInfo, hasSupport);
}

ASSERT(info[last].format != angle::FormatID::NONE);
ASSERT(hasSupport(renderer, info[last].format));
return last;
// We couldn't find a valid fallback, ignore the skip and return 0
return 0;
}

bool HasNonFilterableTextureFormatSupport(vk::Renderer *renderer, angle::FormatID formatID)
Expand Down

0 comments on commit 6f33edd

Please sign in to comment.