1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2005 Blender Foundation. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup gpu 22 * 23 * Uniform buffers API. Used to handle many uniforms update at once. 24 * Make sure that the data structure is compatible with what the implementation expect. 25 * (see "7.6.2.2 Standard Uniform Block Layout" from the OpenGL spec for more info about std140 26 * layout) 27 * Rule of thumb: Padding to 16bytes, don't use vec3, don't use arrays of anything that is not vec4 28 * aligned . 29 */ 30 31 #pragma once 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 struct ListBase; 38 39 /** Opaque type hiding blender::gpu::UniformBuf. */ 40 typedef struct GPUUniformBuf GPUUniformBuf; 41 42 GPUUniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name); 43 GPUUniformBuf *GPU_uniformbuf_create_from_list(struct ListBase *inputs, const char *name); 44 45 #define GPU_uniformbuf_create(size) GPU_uniformbuf_create_ex(size, NULL, __func__); 46 47 void GPU_uniformbuf_free(GPUUniformBuf *ubo); 48 49 void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data); 50 51 void GPU_uniformbuf_bind(GPUUniformBuf *ubo, int slot); 52 void GPU_uniformbuf_unbind(GPUUniformBuf *ubo); 53 void GPU_uniformbuf_unbind_all(void); 54 55 #define GPU_UBO_BLOCK_NAME "nodeTree" 56 57 #ifdef __cplusplus 58 } 59 #endif 60