• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 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_VulkanSampler_DEFINED
9 #define skgpu_graphite_VulkanSampler_DEFINED
10 
11 #include "src/gpu/graphite/Sampler.h"
12 #include "src/gpu/graphite/vk/VulkanSharedContext.h"
13 #include "src/gpu/graphite/vk/VulkanYcbcrConversion.h"
14 
15 #include "include/core/SkRefCnt.h"
16 #include "include/core/SkTileMode.h"
17 
18 struct SkSamplingOptions;
19 
20 namespace skgpu::graphite {
21 
22 class VulkanSampler : public Sampler {
23 public:
24     static sk_sp<VulkanSampler> Make(const VulkanSharedContext*,
25                                      const SkSamplingOptions&,
26                                      SkTileMode xTileMode,
27                                      SkTileMode yTileMode,
28                                      sk_sp<VulkanYcbcrConversion> ycbcrConversion = nullptr);
29 
~VulkanSampler()30     ~VulkanSampler() override {}
31 
vkSampler()32     VkSampler vkSampler() const { return fSampler; }
33 
ycbcrConversion()34     const VulkanYcbcrConversion* ycbcrConversion() const { return fYcbcrConversion.get(); }
35 
36 private:
37     VulkanSampler(const VulkanSharedContext*, VkSampler, sk_sp<VulkanYcbcrConversion>);
38 
39     void freeGpuData() override;
40 
41     VkSampler fSampler;
42     sk_sp<VulkanYcbcrConversion> fYcbcrConversion;
43 };
44 
45 } // namepsace skgpu::graphite
46 
47 #endif // skgpu_graphite_VulkanSampler_DEFINED
48