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 "GrTypes.h" 12 13 #include "GrVkResource.h" 14 15 #include "vk/GrVkDefines.h" 16 17 class GrVkImageView : public GrVkResource { 18 public: 19 enum Type { 20 kColor_Type, 21 kStencil_Type 22 }; 23 24 static const GrVkImageView* Create(const GrVkGpu* gpu, VkImage image, VkFormat format, 25 Type viewType, uint32_t miplevels); 26 imageView()27 VkImageView imageView() const { return fImageView; } 28 29 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()30 void dumpInfo() const override { 31 SkDebugf("GrVkImageView: %d (%d refs)\n", fImageView, this->getRefCnt()); 32 } 33 #endif 34 35 private: GrVkImageView(VkImageView imageView)36 GrVkImageView(VkImageView imageView) : INHERITED(), fImageView(imageView) {} 37 38 GrVkImageView(const GrVkImageView&); 39 GrVkImageView& operator=(const GrVkImageView&); 40 41 void freeGPUData(const GrVkGpu* gpu) const override; 42 43 VkImageView fImageView; 44 45 typedef GrVkResource INHERITED; 46 }; 47 48 #endif 49