Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 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 | |
Greg Daniel | 54bfb18 | 2018-11-20 17:12:36 -0500 | [diff] [blame] | 11 | #include "GrVkVulkan.h" |
| 12 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 13 | #include "GrTypes.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 14 | #include "GrVkResource.h" |
| 15 | |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 16 | class GrVkSamplerYcbcrConversion; |
| 17 | struct GrVkYcbcrConversionInfo; |
| 18 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 19 | class GrVkImageView : public GrVkResource { |
| 20 | public: |
| 21 | enum Type { |
| 22 | kColor_Type, |
| 23 | kStencil_Type |
| 24 | }; |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 25 | |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 26 | static const GrVkImageView* Create(GrVkGpu* gpu, VkImage image, VkFormat format, |
| 27 | Type viewType, uint32_t miplevels, |
| 28 | const GrVkYcbcrConversionInfo& ycbcrInfo); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 29 | |
| 30 | VkImageView imageView() const { return fImageView; } |
| 31 | |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 32 | #ifdef SK_TRACE_VK_RESOURCES |
| 33 | void dumpInfo() const override { |
| 34 | SkDebugf("GrVkImageView: %d (%d refs)\n", fImageView, this->getRefCnt()); |
| 35 | } |
| 36 | #endif |
| 37 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 38 | private: |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 39 | GrVkImageView(VkImageView imageView, GrVkSamplerYcbcrConversion* ycbcrConversion) |
| 40 | : INHERITED(), fImageView(imageView), fYcbcrConversion(ycbcrConversion) {} |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 41 | |
| 42 | GrVkImageView(const GrVkImageView&); |
| 43 | GrVkImageView& operator=(const GrVkImageView&); |
| 44 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame^] | 45 | void freeGPUData(GrVkGpu* gpu) const override; |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 46 | void abandonGPUData() const override; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 47 | |
| 48 | VkImageView fImageView; |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 49 | GrVkSamplerYcbcrConversion* fYcbcrConversion; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 50 | |
| 51 | typedef GrVkResource INHERITED; |
| 52 | }; |
| 53 | |
jvanverth | e50f3e7 | 2016-03-28 07:03:06 -0700 | [diff] [blame] | 54 | #endif |