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