Skip to content

Commit b46479c

Browse files
author
Jonah Williams
authored
[Impeller] check both linear sampling props for AHBs. (#162043)
According to KhronosGroup/Vulkan-ValidationLayers#5806 , both eSampledImageYcbcrConversionLinearFilter and eSampledImageFilterLinear properties are required to use a linear chromaFilter.
1 parent 6a8d77d commit b46479c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

engine/src/flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ static std::shared_ptr<YUVConversionVK> CreateYUVConversion(
146146
const auto& ahb_format =
147147
ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
148148

149+
// See https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5806
150+
// Both features are required.
149151
const bool supports_linear_filtering =
150152
!!(ahb_format.formatFeatures &
151-
vk::FormatFeatureFlagBits::eSampledImageYcbcrConversionLinearFilter);
152-
153+
vk::FormatFeatureFlagBits::eSampledImageYcbcrConversionLinearFilter) &&
154+
!!(ahb_format.formatFeatures &
155+
vk::FormatFeatureFlagBits::eSampledImageFilterLinear);
153156
auto& conversion_info = conversion_chain.get();
154157

155158
conversion_info.format = ahb_format.format;
@@ -160,6 +163,7 @@ static std::shared_ptr<YUVConversionVK> CreateYUVConversion(
160163
conversion_info.yChromaOffset = ahb_format.suggestedYChromaOffset;
161164
conversion_info.chromaFilter =
162165
supports_linear_filtering ? vk::Filter::eLinear : vk::Filter::eNearest;
166+
163167
conversion_info.forceExplicitReconstruction = false;
164168

165169
if (conversion_info.format == vk::Format::eUndefined) {
@@ -297,7 +301,6 @@ AHBTextureSourceVK::AHBTextureSourceVK(
297301
}
298302

299303
const auto& context = ContextVK::Cast(*p_context);
300-
301304
const auto& device = context.GetDevice();
302305
const auto& physical_device = context.GetPhysicalDevice();
303306

0 commit comments

Comments
 (0)