Blender V5.3
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::gpu {
18
22class GLStorageBuf : public StorageBuf {
23 private:
25 int slot_ = -1;
27 GLuint ssbo_id_ = 0;
29 GPUUsageType usage_ = GPUUsageType(-1);
30 /* Read */
31 GLuint read_ssbo_id_ = 0;
32 GLsync read_fence_ = 0;
33 void *persistent_ptr_ = nullptr;
34 size_t alloc_size_in_bytes_ = 0;
35
36 public:
37 GLStorageBuf(size_t size, GPUUsageType usage, const char *name);
39
40 void update(const void *data) override;
41 void bind(int slot) override;
42 void unbind() override;
43 void clear(uint32_t clear_value) override;
44 void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
45 void read(void *data) override;
46 void async_flush_to_host() override;
47 void sync_as_indirect_buffer() override;
48
49 /* Special internal function to bind SSBOs to indirect argument targets. */
50 void bind_as(GLenum target);
51
52 private:
53 void init();
54
55 MEM_CXX_CLASS_ALLOC_FUNCS("GLStorageBuf");
56};
57
58} // namespace blender::gpu
Read Blender memory allocation and freeing.
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 read(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
StorageBuf(size_t size, const char *name)
unsigned int uint
Definition BKE_text.h:55
unsigned int uint32_t
Definition BKE_text.h:81
BMesh const char void * data