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