• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
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 skgpu_MtlSampler_DEFINED
9 #define skgpu_MtlSampler_DEFINED
10 
11 #include "experimental/graphite/src/Sampler.h"
12 
13 #include "include/core/SkRefCnt.h"
14 #include "include/core/SkTileMode.h"
15 #include "include/ports/SkCFObject.h"
16 
17 #import <Metal/Metal.h>
18 
19 struct SkSamplingOptions;
20 
21 namespace skgpu::mtl {
22 
23 class Gpu;
24 
25 class Sampler : public skgpu::Sampler {
26 public:
27     static sk_sp<Sampler> Make(const Gpu*,
28                                const SkSamplingOptions& samplingOptions,
29                                SkTileMode xTileMode,
30                                SkTileMode yTileMode);
31 
~Sampler()32     ~Sampler() override {}
33 
mtlSamplerState()34     id<MTLSamplerState> mtlSamplerState() const { return fSamplerState.get(); }
35 
36 private:
37     Sampler(const Gpu* gpu,
38             sk_cfp<id<MTLSamplerState>>);
39 
40     void onFreeGpuData() override;
41 
42     sk_cfp<id<MTLSamplerState>> fSamplerState;
43 };
44 
45 } // namepsace skgpu::mtl
46 
47 #endif // skgpu_MtlSampler_DEFINED
48