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 | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 16 | class GrVkImageView : public GrVkResource { |
| 17 | public: |
| 18 | enum Type { |
| 19 | kColor_Type, |
| 20 | kStencil_Type |
| 21 | }; |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 22 | |
Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 23 | static const GrVkImageView* Create(const GrVkGpu* gpu, VkImage image, VkFormat format, |
jvanverth | 6234006 | 2016-04-26 08:01:44 -0700 | [diff] [blame] | 24 | Type viewType, uint32_t miplevels); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 25 | |
| 26 | VkImageView imageView() const { return fImageView; } |
| 27 | |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 28 | #ifdef SK_TRACE_VK_RESOURCES |
| 29 | void dumpInfo() const override { |
| 30 | SkDebugf("GrVkImageView: %d (%d refs)\n", fImageView, this->getRefCnt()); |
| 31 | } |
| 32 | #endif |
| 33 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 34 | private: |
| 35 | GrVkImageView(VkImageView imageView) : INHERITED(), fImageView(imageView) {} |
| 36 | |
| 37 | GrVkImageView(const GrVkImageView&); |
| 38 | GrVkImageView& operator=(const GrVkImageView&); |
| 39 | |
| 40 | void freeGPUData(const GrVkGpu* gpu) const override; |
| 41 | |
| 42 | VkImageView fImageView; |
| 43 | |
| 44 | typedef GrVkResource INHERITED; |
| 45 | }; |
| 46 | |
jvanverth | e50f3e7 | 2016-03-28 07:03:06 -0700 | [diff] [blame] | 47 | #endif |