Blender  V3.3
gl_storage_buffer.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2022 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "MEM_guardedalloc.h"
11 
13 
14 #include "glew-mx.h"
15 
16 namespace blender {
17 namespace gpu {
18 
22 class GLStorageBuf : public StorageBuf {
23  private:
25  int slot_ = -1;
27  GLuint ssbo_id_ = 0;
29  GPUUsageType usage_;
30 
31  public:
32  GLStorageBuf(size_t size, GPUUsageType usage, const char *name);
33  ~GLStorageBuf();
34 
35  void update(const void *data) override;
36  void bind(int slot) override;
37  void unbind() override;
38  void clear(eGPUTextureFormat internal_format, eGPUDataFormat data_format, void *data) override;
39  void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override;
40 
41  /* Special internal function to bind SSBOs to indirect argument targets. */
42  void bind_as(GLenum target);
43 
44  private:
45  void init();
46 
47  MEM_CXX_CLASS_ALLOC_FUNCS("GLStorageBuf");
48 };
49 
50 } // namespace gpu
51 } // namespace blender
unsigned int uint
Definition: BLI_sys_types.h:67
eGPUDataFormat
Definition: GPU_texture.h:170
eGPUTextureFormat
Definition: GPU_texture.h:83
GPUUsageType
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
void clear(eGPUTextureFormat internal_format, eGPUDataFormat data_format, void *data) override
void bind(int slot) override
void update(const void *data) override
GLStorageBuf(size_t size, GPUUsageType usage, const char *name)
void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) override
SyclQueue void void * src