Skip to content

Commit

Permalink
[Impeller] correctly map DL non-mipmap sample mode to non-mipmap samp…
Browse files Browse the repository at this point in the history
…le mode. (flutter#53161)

Match DL/Skia sampling defaults. This does not change the default SamplerDescriptor value, but that is irrelevant as any draws from the framework will pass through DL conversion.

The SamplerDescriptor default of nearest is generally a good idea.

Fixes flutter/flutter#148253
  • Loading branch information
jonahwilliams committed Jun 5, 2024
1 parent 7ce5385 commit a611a82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 0 additions & 5 deletions impeller/core/sampler_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ class Context;
struct SamplerDescriptor final : public Comparable<SamplerDescriptor> {
MinMagFilter min_filter = MinMagFilter::kNearest;
MinMagFilter mag_filter = MinMagFilter::kNearest;

// TODO(https://github.com/flutter/flutter/issues/148253):
// `MipFilter::kNearest` is the default value for mip filters, as it
// cooresponds with the framework's `FilterQuality.low`. If we ever change the
// default filter quality, we should update this function to match.
MipFilter mip_filter = MipFilter::kNearest;

SamplerAddressMode width_address_mode = SamplerAddressMode::kClampToEdge;
Expand Down
5 changes: 2 additions & 3 deletions impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@ static impeller::SamplerDescriptor ToSamplerDescriptor(
desc.label = "Nearest Sampler";
break;
case flutter::DlImageSampling::kLinear:
// Impeller doesn't support cubic sampling, but linear is closer to correct
// than nearest for this case.
case flutter::DlImageSampling::kCubic:
desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
desc.mip_filter = impeller::MipFilter::kBase;
desc.label = "Linear Sampler";
break;
case flutter::DlImageSampling::kCubic:
case flutter::DlImageSampling::kMipmapLinear:
desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
desc.mip_filter = impeller::MipFilter::kLinear;
Expand Down

0 comments on commit a611a82

Please sign in to comment.