1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrMtlSampler_DEFINED 9 #define GrMtlSampler_DEFINED 10 11 #import <metal/metal.h> 12 13 class GrSamplerState; 14 class GrMtlGpu; 15 16 // This class only acts as a wrapper for a MTLSamplerState object for now, but will be more useful 17 // once we start caching sampler states. 18 class GrMtlSampler { 19 public: 20 static GrMtlSampler* Create(const GrMtlGpu* gpu, const GrSamplerState&, uint32_t maxMipLevel); 21 mtlSamplerState()22 id<MTLSamplerState> mtlSamplerState() const { return fMtlSamplerState; } 23 24 private: GrMtlSampler(id<MTLSamplerState> mtlSamplerState)25 GrMtlSampler(id<MTLSamplerState> mtlSamplerState) : fMtlSamplerState(mtlSamplerState) {} 26 27 id<MTLSamplerState> fMtlSamplerState; 28 }; 29 30 #endif 31