67 {
68 wgpu::SamplerDescriptor
desc;
71 desc.magFilter = filter_mode_to_dawn_filter_mode(samplingOptions.
filter);
73 desc.mipmapFilter = mipmap_mode_to_dawn_filter_mode(samplingOptions.
mipmap);
74 desc.lodMinClamp = 0.0f;
76
77 desc.lodMaxClamp = 0.0f;
78 } else {
79 desc.lodMaxClamp = FLT_MAX;
80 }
81 desc.maxAnisotropy = 1;
82 desc.compare = wgpu::CompareFunction::Undefined;
83
84 std::string label;
86 static const char* tileModeLabels[] = {"Clamp", "Repeat", "Mirror", "Decal"};
87 static const char* minMagFilterLabels[] = {"Nearest", "Linear"};
88 static const char* mipFilterLabels[] = {"MipNone", "MipNearest", "MipLinear"};
89 label.append("X").append(tileModeLabels[static_cast<int>(xTileMode)]);
90 label.append("Y").append(tileModeLabels[static_cast<int>(yTileMode)]);
91 label.append(minMagFilterLabels[
static_cast<int>(samplingOptions.
filter)]);
92 label.append(mipFilterLabels[
static_cast<int>(samplingOptions.
mipmap)]);
93 desc.label = label.c_str();
94 }
95
97 if (!sampler) {
98 return {};
99 }
101}
bool setBackendLabels() const
const SharedContext * sharedContext() const
const Caps * caps() const
static wgpu::AddressMode tile_mode_to_dawn_address_mode(SkTileMode tileMode)
const SkFilterMode filter
const SkMipmapMode mipmap