This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/gpu/GPU_uniform_buffer.h
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00

51 lines
1.5 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2005 Blender Foundation. All rights reserved. */
/** \file
* \ingroup gpu
*
* Uniform buffers API. Used to handle many uniforms update at once.
* Make sure that the data structure is compatible with what the implementation expect.
* (see "7.6.2.2 Standard Uniform Block Layout" from the OpenGL spec for more info about std140
* layout)
* Rule of thumb: Padding to 16bytes, don't use vec3, don't use arrays of anything that is not vec4
* aligned .
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct ListBase;
/** Opaque type hiding blender::gpu::UniformBuf. */
typedef struct GPUUniformBuf GPUUniformBuf;
GPUUniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name);
/**
* Create UBO from inputs list.
* Return NULL if failed to create or if \param inputs: is empty.
*
* \param inputs: ListBase of #BLI_genericNodeN(#GPUInput).
*/
GPUUniformBuf *GPU_uniformbuf_create_from_list(struct ListBase *inputs, const char *name);
#define GPU_uniformbuf_create(size) GPU_uniformbuf_create_ex(size, NULL, __func__);
void GPU_uniformbuf_free(GPUUniformBuf *ubo);
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data);
void GPU_uniformbuf_bind(GPUUniformBuf *ubo, int slot);
void GPU_uniformbuf_unbind(GPUUniformBuf *ubo);
void GPU_uniformbuf_unbind_all(void);
#define GPU_UBO_BLOCK_NAME "nodeTree"
#define GPU_ATTRIBUTE_UBO_BLOCK_NAME "uniformAttrs"
#ifdef __cplusplus
}
#endif