Blender V5.0
vk_index_buffer.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "GPU_index_buffer.hh"
12
13#include "vk_buffer.hh"
14
15namespace blender::gpu {
16
17class VKIndexBuffer : public IndexBuf {
18 VKBuffer buffer_;
19 bool data_uploaded_ = false;
20
21 public:
22 void upload_data() override;
23
24 void bind_as_ssbo(uint binding) override;
25
26 void read(uint32_t *data) const override;
27
28 void update_sub(uint start, uint len, const void *data) override;
29
30 VkBuffer vk_handle() const
31 {
32 return buffer_get().vk_handle();
33 }
34 inline VkDeviceAddress device_address_get() const
35 {
36 return buffer_get().device_address_get();
37 }
38 VkIndexType vk_index_type() const
39 {
41 }
42
43 void ensure_updated();
44
45 private:
46 void strip_restart_indices() override;
47 void allocate();
49 const VKBuffer &buffer_get() const;
50};
51
52static inline VKIndexBuffer *unwrap(IndexBuf *index_buffer)
53{
54 return static_cast<VKIndexBuffer *>(index_buffer);
55}
56
57} // namespace blender::gpu
unsigned int uint
BMesh const char void * data
GPUIndexBufType index_type_
VkIndexType vk_index_type() const
void update_sub(uint start, uint len, const void *data) override
VkDeviceAddress device_address_get() const
void bind_as_ssbo(uint binding) override
#define buffer_get(create_info, _res)
static Context * unwrap(GPUContext *ctx)
VkIndexType to_vk_index_type(const GPUIndexBufType index_type)
Definition vk_common.cc:633
uint len