Blender V4.5
vk_storage_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_texture.hh"
12
13#include "GPU_vertex_buffer.hh"
15
16#include "vk_buffer.hh"
17#include "vk_staging_buffer.hh"
18
19namespace blender::gpu {
20class VertBuf;
21
23 GPUUsageType usage_;
24 VKBuffer buffer_;
25
27 VKStagingBuffer *async_read_buffer_ = nullptr;
28
29 public:
30 VKStorageBuffer(size_t size, GPUUsageType usage, const char *name);
32
33 void update(const void *data) override;
34 void bind(int slot) override;
35 void unbind() override;
36 void clear(uint32_t clear_value) override;
37 void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
38 void read(void *data) override;
39 void async_flush_to_host() override;
40 void sync_as_indirect_buffer() override{/* No-Op. */};
41
42 VkBuffer vk_handle() const
43 {
44 return buffer_.vk_handle();
45 }
46 inline VkDeviceAddress device_address_get() const
47 {
48 return buffer_.device_address_get();
49 }
50
52 {
53 return buffer_.size_in_bytes();
54 }
55
56 void ensure_allocated();
57
58 private:
59 void allocate();
60};
61
63{
64 return static_cast<VKStorageBuffer *>(storage_buffer);
65}
66
67} // namespace blender::gpu
#define BLI_INLINE
unsigned int uint
BMesh const char void * data
long long int int64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
StorageBuf(size_t size, const char *name)
void update(const void *data) override
void clear(uint32_t clear_value) override
void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override
VKStorageBuffer(size_t size, GPUUsageType usage, const char *name)
void bind(int slot) override
VkDeviceAddress device_address_get() const
static Context * unwrap(GPUContext *ctx)
read