blob: b7e35c73f4103e70a787461471db48fb0a0d9efe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GrVkBufferView.h"
#include "GrVkGpu.h"
#include "GrVkUtil.h"
const GrVkBufferView* GrVkBufferView::Create(const GrVkGpu* gpu, VkBuffer buffer, VkFormat format,
VkDeviceSize offset, VkDeviceSize range) {
VkBufferView bufferView;
// Create the VkBufferView
VkBufferViewCreateInfo viewInfo;
memset(&viewInfo, 0, sizeof(VkBufferViewCreateInfo));
viewInfo.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
viewInfo.pNext = nullptr;
viewInfo.flags = 0;
viewInfo.buffer = buffer;
viewInfo.format = format;
viewInfo.offset = offset;
viewInfo.range = range;
VkResult err = GR_VK_CALL(gpu->vkInterface(), CreateBufferView(gpu->device(), &viewInfo,
nullptr, &bufferView));
if (err) {
return nullptr;
}
return new GrVkBufferView(bufferView);
}
void GrVkBufferView::freeGPUData(const GrVkGpu* gpu) const {
GR_VK_CALL(gpu->vkInterface(), DestroyBufferView(gpu->device(), fBufferView, nullptr));
}
|