Blender V4.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
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
34 public:
35 GLStorageBuf(size_t size, GPUUsageType usage, const char *name);
37
38 void update(const void *data) override;
39 void bind(int slot) override;
40 void unbind() override;
41 void clear(uint32_t clear_value) override;
42 void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
43 void read(void *data) override;
44 void async_flush_to_host() override;
45 void sync_as_indirect_buffer() override;
46
47 /* Special internal function to bind SSBOs to indirect argument targets. */
48 void bind_as(GLenum target);
49
50 private:
51 void init();
52
53 MEM_CXX_CLASS_ALLOC_FUNCS("GLStorageBuf");
54};
55
56} // namespace gpu
57} // namespace blender
unsigned int uint
Read Guarded memory(de)allocation.
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
unsigned int uint32_t
Definition stdint.h:80