• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright 2016 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 GrVkImageView_DEFINED
9 #define GrVkImageView_DEFINED
10 
11 #include "include/gpu/GrTypes.h"
12 #include "include/gpu/vk/GrVkTypes.h"
13 #include "src/gpu/ganesh/vk/GrVkManagedResource.h"
14 
15 #include <cinttypes>
16 
17 class GrVkSamplerYcbcrConversion;
18 
19 class GrVkImageView : public GrVkManagedResource {
20 public:
21     enum Type {
22         kColor_Type,
23         kStencil_Type
24     };
25 
26     static sk_sp<const GrVkImageView> Make(GrVkGpu* gpu, VkImage image, VkFormat format,
27                                            Type viewType, uint32_t miplevels,
28                                            const GrVkYcbcrConversionInfo& ycbcrInfo);
29 
imageView()30     VkImageView imageView() const { return fImageView; }
31 
32 #ifdef SK_TRACE_MANAGED_RESOURCES
dumpInfo()33     void dumpInfo() const override {
34         SkDebugf("GrVkImageView: %" PRIdPTR " (%d refs)\n",
35                  (intptr_t)fImageView, this->getRefCnt());
36     }
37 #endif
38 
39 private:
GrVkImageView(const GrVkGpu * gpu,VkImageView imageView,GrVkSamplerYcbcrConversion * ycbcrConversion)40     GrVkImageView(const GrVkGpu* gpu, VkImageView imageView,
41                   GrVkSamplerYcbcrConversion* ycbcrConversion)
42             : INHERITED(gpu), fImageView(imageView), fYcbcrConversion(ycbcrConversion) {}
43 
44     void freeGPUData() const override;
45 
46     VkImageView  fImageView;
47     GrVkSamplerYcbcrConversion* fYcbcrConversion;
48 
49     using INHERITED = GrVkManagedResource;
50 };
51 
52 #endif
53