blob: 439a93d9d3020302d9765a7d4298b7be06424afd [file] [log] [blame]
Greg Danielc2dd5ed2017-05-05 13:49:11 -04001/*
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 Daniel54bfb182018-11-20 17:12:36 -050011#include "GrVkVulkan.h"
12
Greg Danielc2dd5ed2017-05-05 13:49:11 -040013#include "GrTypes.h"
Greg Danielc2dd5ed2017-05-05 13:49:11 -040014#include "GrVkResource.h"
15
Greg Danielc2dd5ed2017-05-05 13:49:11 -040016class GrVkBufferView : public GrVkResource {
17public:
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
29private:
30 GrVkBufferView(VkBufferView bufferView) : INHERITED(), fBufferView(bufferView) {}
31
Ethan Nicholas30e63432018-12-11 16:15:15 -050032 void freeGPUData(GrVkGpu* gpu) const override;
Greg Danielc2dd5ed2017-05-05 13:49:11 -040033
34 VkBufferView fBufferView;
35
36 typedef GrVkResource INHERITED;
37};
38
39#endif