Blender V5.0
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
13#include "GPU_vertex_buffer.hh"
14
16
17namespace blender {
18namespace gpu {
19
23class GLStorageBuf : public StorageBuf {
24 private:
26 int slot_ = -1;
28 GLuint ssbo_id_ = 0;
30 GPUUsageType usage_ = GPUUsageType(-1);
31 /* Read */
32 GLuint read_ssbo_id_ = 0;
33 GLsync read_fence_ = 0;
34 void *persistent_ptr_ = nullptr;
35 size_t alloc_size_in_bytes_ = 0;
36
37 public:
38 GLStorageBuf(size_t size, GPUUsageType usage, const char *name);
40
41 void update(const void *data) override;
42 void bind(int slot) override;
43 void unbind() override;
44 void clear(uint32_t clear_value) override;
45 void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
46 void read(void *data) override;
47 void async_flush_to_host() override;
48 void sync_as_indirect_buffer() override;
49
50 /* Special internal function to bind SSBOs to indirect argument targets. */
51 void bind_as(GLenum target);
52
53 private:
54 void init();
55
56 MEM_CXX_CLASS_ALLOC_FUNCS("GLStorageBuf");
57};
58
59} // namespace gpu
60} // 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)
const char * name