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