Blender V4.5
gl_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 "MEM_guardedalloc.h"
12
14
15namespace blender {
16namespace gpu {
17
21class GLStorageBuf : public StorageBuf {
22 private:
24 int slot_ = -1;
26 GLuint ssbo_id_ = 0;
28 GPUUsageType usage_;
29 /* Read */
30 GLuint read_ssbo_id_ = 0;
31 GLsync read_fence_ = 0;
32 void *persistent_ptr_ = nullptr;
33 size_t alloc_size_in_bytes_ = 0;
34
35 public:
36 GLStorageBuf(size_t size, GPUUsageType usage, const char *name);
38
39 void update(const void *data) override;
40 void bind(int slot) override;
41 void unbind() override;
42 void clear(uint32_t clear_value) override;
43 void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
44 void read(void *data) override;
45 void async_flush_to_host() override;
46 void sync_as_indirect_buffer() override;
47
48 /* Special internal function to bind SSBOs to indirect argument targets. */
49 void bind_as(GLenum target);
50
51 private:
52 void init();
53
54 MEM_CXX_CLASS_ALLOC_FUNCS("GLStorageBuf");
55};
56
57} // namespace gpu
58} // namespace blender
unsigned int uint
Read Guarded memory(de)allocation.
BMesh const char void * data
void init()
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
void bind(int slot) override
void update(const void *data) override
void sync_as_indirect_buffer() override
GLStorageBuf(size_t size, GPUUsageType usage, const char *name)
void clear(uint32_t clear_value) override
void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override
StorageBuf(size_t size, const char *name)
read