| 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 |
#ifndef GrVkImageView_DEFINED |
| 8 |
#define GrVkImageView_DEFINED |
| 9 |
|
| 10 |
#include "include/core/SkRefCnt.h" |
| 11 |
#include "include/private/base/SkDebug.h" |
| 12 |
#include "include/private/gpu/vk/SkiaVulkan.h" |
| 13 |
#include "src/gpu/ganesh/GrManagedResource.h" |
| 14 |
#include "src/gpu/ganesh/vk/GrVkManagedResource.h" |
| 15 |
|
| 16 |
#include <cinttypes> |
| 17 |
#include <cstdint> |
| 18 |
|
| 19 |
class GrVkGpu; |
| 20 |
class GrVkSamplerYcbcrConversion; |
| 21 |
|
| 22 |
namespace skgpu { |
| 23 |
struct VulkanYcbcrConversionInfo; |
| 24 |
} |
| 25 |
|
| 26 |
class GrVkImageView : public GrVkManagedResource { |
| 27 |
public: |
| 28 |
enum Type { |
| 29 |
kColor_Type, |
| 30 |
kStencil_Type |
| 31 |
}; |
| 32 |
|
| 33 |
static sk_sp<const GrVkImageView> Make(GrVkGpu* gpu, |
| 34 |
VkImage image, |
| 35 |
VkFormat format, |
| 36 |
Type viewType, |
| 37 |
uint32_t miplevels, |
| 38 |
const skgpu::VulkanYcbcrConversionInfo& ycbcrInfo); |
| 39 |
|
| 40 |
VkImageView imageView() const { return fImageView; } |
| 41 |
|
| 42 |
#ifdef SK_TRACE_MANAGED_RESOURCES |
| 43 |
void dumpInfo() const override { |
| 44 |
SkDebugf("GrVkImageView: %" PRIdPTR " (%d refs)\n", |
| 45 |
(intptr_t)fImageView, this->getRefCnt()); |
| 46 |
} |
| 47 |
#endif |
| 48 |
|
| 49 |
private: |
| 50 |
GrVkImageView(const GrVkGpu* gpu, VkImageView imageView, |
| 51 |
GrVkSamplerYcbcrConversion* ycbcrConversion) |
| 52 |
: INHERITED(gpu), fImageView(imageView), fYcbcrConversion(ycbcrConversion) {} |
| 53 |
|
| 54 |
void freeGPUData() const override; |
| 55 |
|
| 56 |
VkImageView fImageView; |
| 57 |
GrVkSamplerYcbcrConversion* fYcbcrConversion; |
| 58 |
|
| 59 |
using INHERITED = GrVkManagedResource; |
| 60 |
}; |
| 61 |
|
| 62 |
#endif |