Blender V5.3
GPU_uniform_buffer.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
15
16#pragma once
17
18#include "BLI_sys_types.hh"
19
20#include "DNA_listBase.h"
21
22namespace blender {
23
24struct GPUInput;
25
26namespace gpu {
27class UniformBuf;
28} // namespace gpu
29
30gpu::UniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name);
37gpu::UniformBuf *GPU_uniformbuf_create_from_list(ListBaseT<LinkData> *inputs, const char *name);
38
39/* Sort input list in order to ensure minimum padding. */
40void GPU_uniformbuf_inputs_sort(ListBaseT<LinkData> *inputs);
41
42#define GPU_uniformbuf_create(size) GPU_uniformbuf_create_ex(size, nullptr, __func__);
43
44void GPU_uniformbuf_free(gpu::UniformBuf *ubo);
45
46void GPU_uniformbuf_update(gpu::UniformBuf *ubo, const void *data);
47
48void GPU_uniformbuf_bind(gpu::UniformBuf *ubo, int slot);
49void GPU_uniformbuf_bind_as_ssbo(gpu::UniformBuf *ubo, int slot);
50void GPU_uniformbuf_unbind(gpu::UniformBuf *ubo);
56
57void GPU_uniformbuf_clear_to_zero(gpu::UniformBuf *ubo);
58
59#define GPU_UBO_BLOCK_NAME "node_tree"
60#define GPU_ATTRIBUTE_UBO_BLOCK_NAME "unf_attrs"
61#define GPU_LAYER_ATTRIBUTE_UBO_BLOCK_NAME "drw_layer_attrs"
62constexpr static int GPU_NODE_TREE_UBO_SLOT = 0;
63
64#define GPU_UBO_FREE_SAFE(ubo) \
65 do { \
66 if (ubo != nullptr) { \
67 GPU_uniformbuf_free(ubo); \
68 ubo = nullptr; \
69 } \
70 } while (0)
71
72} // namespace blender
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
void GPU_uniformbuf_free(gpu::UniformBuf *ubo)
static constexpr int GPU_NODE_TREE_UBO_SLOT
BMesh const char void * data
void GPU_uniformbuf_bind_as_ssbo(gpu::UniformBuf *ubo, int slot)
void GPU_uniformbuf_bind(gpu::UniformBuf *ubo, int slot)
gpu::UniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_uniformbuf_update(gpu::UniformBuf *ubo, const void *data)
gpu::UniformBuf * GPU_uniformbuf_create_from_list(ListBaseT< LinkData > *inputs, const char *name)
void GPU_uniformbuf_clear_to_zero(gpu::UniformBuf *ubo)
void GPU_uniformbuf_inputs_sort(ListBaseT< LinkData > *inputs)
void GPU_uniformbuf_debug_unbind_all()
void GPU_uniformbuf_unbind(gpu::UniformBuf *ubo)