12#if !__has_feature(objc_arc)
13#error This file must be compiled with Arc. Use -fobjc-arc flag
22 return MTLSamplerAddressModeClampToEdge;
24 return MTLSamplerAddressModeRepeat;
26 return MTLSamplerAddressModeMirrorRepeat;
31#ifdef SK_BUILD_FOR_MAC
32 if (@available(macOS 10.12, *)) {
34 return MTLSamplerAddressModeClampToBorderColor;
39 return MTLSamplerAddressModeClampToEdge;
46 MTLSamplerMinMagFilter minMagFilter = [&] {
47 switch (samplerState.
filter()) {
54 MTLSamplerMipFilter mipFilter = [&] {
63 auto samplerDesc = [[MTLSamplerDescriptor alloc]
init];
64 samplerDesc.rAddressMode = MTLSamplerAddressModeClampToEdge;
69 samplerDesc.magFilter = minMagFilter;
70 samplerDesc.minFilter = minMagFilter;
71 samplerDesc.mipFilter = mipFilter;
72 samplerDesc.lodMinClamp = 0.0f;
73 samplerDesc.lodMaxClamp = FLT_MAX;
76 samplerDesc.normalizedCoordinates =
true;
77 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
78 samplerDesc.compareFunction = MTLCompareFunctionNever;
88 return samplerState.
asKey(
true);
static GR_NORETAIN_BEGIN MTLSamplerAddressMode wrap_mode_to_mtl_sampler_address(GrSamplerState::WrapMode wrapMode, const GrCaps &caps)
#define SK_ABORT(message,...)
bool clampToBorderSupport() const
const GrMtlCaps & mtlCaps() const
id< MTLDevice > device() const
static Key GenerateKey(GrSamplerState)
static GrMtlSampler * Create(const GrMtlGpu *gpu, GrSamplerState)
constexpr WrapMode wrapModeX() const
constexpr Filter filter() const
uint32_t asKey(bool anisoIsOrthogonal) const
constexpr MipmapMode mipmapMode() const
constexpr WrapMode wrapModeY() const
static float min(float r, float g, float b)