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_graphite_DawnSampler_DEFINED 9 #define skgpu_graphite_DawnSampler_DEFINED 10 11 #include "src/gpu/graphite/Sampler.h" 12 13 #include "include/core/SkTileMode.h" 14 #include "webgpu/webgpu_cpp.h" 15 16 struct SkSamplingOptions; 17 18 namespace skgpu::graphite { 19 20 class DawnSharedContext; 21 22 class DawnSampler : public Sampler { 23 public: 24 static sk_sp<DawnSampler> Make(const DawnSharedContext*, 25 const SkSamplingOptions& samplingOptions, 26 SkTileMode xTileMode, 27 SkTileMode yTileMode); ~DawnSampler()28 ~DawnSampler() override {} 29 dawnSampler()30 const wgpu::Sampler& dawnSampler() const { return fSampler; } 31 32 private: 33 DawnSampler(const DawnSharedContext* sharedContext, 34 wgpu::Sampler sampler); 35 36 void freeGpuData() override; 37 38 wgpu::Sampler fSampler; 39 }; 40 41 } // namepsace skgpu::graphite 42 43 #endif // skgpu_graphite_DawnSampler_DEFINED 44