Today, AHB backed textures will prefer linear sampling (after checking for VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT) and fallback to nearest sampling. That is, sampling will ignore the min and mag filter specified in the impeller::SamplerDescriptor. This is because of stricter requirements when sampling from AHBs.
If VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT is not supported, there is no way linear sample without a render to an intermediate texture.
On the other hand, if VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT is supported, using nearest sampling is not possible today because we create only a single conversion.
It may be tempting to just check for VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT and use whatever is specified in the impeller::SamplerDescriptor. While this is extremely convenient, in practice, this bit is never set on most Android formats.
To work around this, a completely separate conversion must be created and cached in the conversions library. And, in the relatively uncommon case where linear sampling is not supported, a separate render to texture must be performed.
This describes an edge case since most uses require linear sampling and that seems to be well supported out of the box. But, if we get reports of users depending on specific kinds of sampling, we should look into using separate conversions and (in extreme cases to catch lack of support for direct linear sampling) render to texture.
Today, AHB backed textures will prefer linear sampling (after checking for
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
) and fallback to nearest sampling. That is, sampling will ignore the min and mag filter specified in theimpeller::SamplerDescriptor
. This is because of stricter requirements when sampling from AHBs.If
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
is not supported, there is no way linear sample without a render to an intermediate texture.On the other hand, if
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
is supported, using nearest sampling is not possible today because we create only a single conversion.It may be tempting to just check for
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT
and use whatever is specified in theimpeller::SamplerDescriptor
. While this is extremely convenient, in practice, this bit is never set on most Android formats.To work around this, a completely separate conversion must be created and cached in the conversions library. And, in the relatively uncommon case where linear sampling is not supported, a separate render to texture must be performed.
This describes an edge case since most uses require linear sampling and that seems to be well supported out of the box. But, if we get reports of users depending on specific kinds of sampling, we should look into using separate conversions and (in extreme cases to catch lack of support for direct linear sampling) render to texture.