Blender V4.5
gpu_storage_buffer_private.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 "BLI_sys_types.h"
12
13struct GPUStorageBuf;
14
15namespace blender::gpu {
16
17class VertBuf;
18
19#ifndef NDEBUG
20# define DEBUG_NAME_LEN 64
21#else
22# define DEBUG_NAME_LEN 8
23#endif
24
30 protected:
34 void *data_ = nullptr;
37
38 public:
39 StorageBuf(size_t size, const char *name);
40 virtual ~StorageBuf();
41
42 virtual void update(const void *data) = 0;
43 virtual void bind(int slot) = 0;
44 virtual void unbind() = 0;
45 virtual void clear(uint32_t clear_value) = 0;
46 virtual void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size) = 0;
47 virtual void read(void *data) = 0;
48 virtual void async_flush_to_host() = 0;
49 virtual void sync_as_indirect_buffer() = 0;
50};
51
52/* Syntactic sugar. */
53static inline GPUStorageBuf *wrap(StorageBuf *storage_buf)
54{
55 return reinterpret_cast<GPUStorageBuf *>(storage_buf);
56}
57static inline StorageBuf *unwrap(GPUStorageBuf *storage_buf)
58{
59 return reinterpret_cast<StorageBuf *>(storage_buf);
60}
61static inline const StorageBuf *unwrap(const GPUStorageBuf *storage_buf)
62{
63 return reinterpret_cast<const StorageBuf *>(storage_buf);
64}
65
66#undef DEBUG_NAME_LEN
67
68} // namespace blender::gpu
unsigned int uint
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
StorageBuf(size_t size, const char *name)
virtual void unbind()=0
virtual void bind(int slot)=0
virtual void read(void *data)=0
virtual void async_flush_to_host()=0
virtual void clear(uint32_t clear_value)=0
virtual void update(const void *data)=0
virtual void copy_sub(VertBuf *src, uint dst_offset, uint src_offset, uint copy_size)=0
virtual void sync_as_indirect_buffer()=0
#define DEBUG_NAME_LEN
static Context * unwrap(GPUContext *ctx)
static GPUContext * wrap(Context *ctx)