Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 GrVkBufferView_DEFINED |
| 9 | #define GrVkBufferView_DEFINED |
| 10 | |
Greg Daniel | 54bfb18 | 2018-11-20 17:12:36 -0500 | [diff] [blame] | 11 | #include "GrVkVulkan.h" |
| 12 | |
Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 13 | #include "GrTypes.h" |
Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 14 | #include "GrVkResource.h" |
| 15 | |
Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 16 | class GrVkBufferView : public GrVkResource { |
| 17 | public: |
| 18 | static const GrVkBufferView* Create(const GrVkGpu* gpu, VkBuffer buffer, VkFormat format, |
| 19 | VkDeviceSize offset, VkDeviceSize range); |
| 20 | |
| 21 | VkBufferView bufferView() const { return fBufferView; } |
| 22 | |
| 23 | #ifdef SK_TRACE_VK_RESOURCES |
| 24 | void dumpInfo() const override { |
| 25 | SkDebugf("GrVkBufferView: %d (%d refs)\n", fBufferView, this->getRefCnt()); |
| 26 | } |
| 27 | #endif |
| 28 | |
| 29 | private: |
| 30 | GrVkBufferView(VkBufferView bufferView) : INHERITED(), fBufferView(bufferView) {} |
| 31 | |
Greg Daniel | c2dd5ed | 2017-05-05 13:49:11 -0400 | [diff] [blame] | 32 | void freeGPUData(const GrVkGpu* gpu) const override; |
| 33 | |
| 34 | VkBufferView fBufferView; |
| 35 | |
| 36 | typedef GrVkResource INHERITED; |
| 37 | }; |
| 38 | |
| 39 | #endif |