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 11 #include "include/gpu/GrTypes.h" 12 #include "include/gpu/vk/GrVkTypes.h" 13 #include "src/gpu/vk/GrVkResource.h" 14 15 class GrVkBufferView : public GrVkResource { 16 public: 17 static const GrVkBufferView* Create(const GrVkGpu* gpu, VkBuffer buffer, VkFormat format, 18 VkDeviceSize offset, VkDeviceSize range); 19 bufferView()20 VkBufferView bufferView() const { return fBufferView; } 21 22 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()23 void dumpInfo() const override { 24 SkDebugf("GrVkBufferView: %d (%d refs)\n", fBufferView, this->getRefCnt()); 25 } 26 #endif 27 28 private: GrVkBufferView(VkBufferView bufferView)29 GrVkBufferView(VkBufferView bufferView) : INHERITED(), fBufferView(bufferView) {} 30 31 void freeGPUData(GrVkGpu* gpu) const override; 32 33 VkBufferView fBufferView; 34 35 typedef GrVkResource INHERITED; 36 }; 37 38 #endif 39