• 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/vk/GrVkManagedResource.h"
14 
15 #include <cinttypes>
16 
17 class GrVkSamplerYcbcrConversion;
18 struct GrVkYcbcrConversionInfo;
19 
20 class GrVkImageView : public GrVkManagedResource {
21 public:
22     enum Type {
23         kColor_Type,
24         kStencil_Type
25     };
26 
27     static sk_sp<const GrVkImageView> Make(GrVkGpu* gpu, VkImage image, VkFormat format,
28                                            Type viewType, uint32_t miplevels,
29                                            const GrVkYcbcrConversionInfo& ycbcrInfo);
30 
imageView()31     VkImageView imageView() const { return fImageView; }
32     // OH ISSUE: Integrate Destroy
33     static void DestroyImageView(const GrVkGpu* gpu, const VkImageView& imageView);
34 
35 #ifdef SK_TRACE_MANAGED_RESOURCES
dumpInfo()36     void dumpInfo() const override {
37         SkDebugf("GrVkImageView: %" PRIdPTR " (%d refs)\n",
38                  (intptr_t)fImageView, this->getRefCnt());
39     }
40 #endif
41 
42 private:
GrVkImageView(const GrVkGpu * gpu,VkImageView imageView,GrVkSamplerYcbcrConversion * ycbcrConversion)43     GrVkImageView(const GrVkGpu* gpu, VkImageView imageView,
44                   GrVkSamplerYcbcrConversion* ycbcrConversion)
45             : INHERITED(gpu), fImageView(imageView), fYcbcrConversion(ycbcrConversion) {}
46 
47     void freeGPUData() const override;
48 
49     VkImageView  fImageView;
50     GrVkSamplerYcbcrConversion* fYcbcrConversion;
51 
52     using INHERITED = GrVkManagedResource;
53 };
54 
55 #endif
56