18const std::unique_ptr<const Sampler>& SamplerLibraryMTL::GetSampler(
20 auto found = samplers_.find(descriptor);
21 if (found != samplers_.end()) {
27 auto desc = [[MTLSamplerDescriptor alloc] init];
34 if (@available(iOS 14.0, macos 10.12, *)) {
35 desc.borderColor = MTLSamplerBorderColorTransparentBlack;
37 if (!descriptor.
label.empty()) {
38 desc.label = @(descriptor.
label.c_str());
41 auto mtl_sampler = [device_ newSamplerStateWithDescriptor:desc];
46 std::unique_ptr<SamplerMTL>(
new SamplerMTL(descriptor, mtl_sampler));
48 return (samplers_[descriptor] = std::move(sampler));