Blender  V2.93
draw_instance_data.h
Go to the documentation of this file.
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  * Copyright 2016, Blender Foundation.
17  */
18 
23 #pragma once
24 
25 #include "BLI_compiler_attrs.h"
26 #include "BLI_sys_types.h"
27 
28 #include "GPU_batch.h"
29 
30 #define MAX_INSTANCE_DATA_SIZE 64 /* Can be adjusted for more */
31 
32 #define DRW_BUFFER_VERTS_CHUNK 128
33 
34 struct GHash;
35 struct GPUUniformAttrList;
36 
37 typedef struct DRWInstanceData DRWInstanceData;
40 
43 
46  int *vert_len);
48  GPUVertBuf *buf,
49  GPUBatch *instancer,
50  GPUBatch *geom);
52  GPUVertBuf *buf,
54 
55 /* Upload all instance data to the GPU as soon as possible. */
57 
61 
62 /* Sparse chunked UBO manager. */
64  unsigned int chunk_size);
69 void DRW_sparse_uniform_buffer_bind(DRWSparseUniformBuf *buffer, int chunk, int location);
72 
73 /* Uniform attribute UBO management. */
74 struct GHash *DRW_uniform_attrs_pool_new(void);
75 void DRW_uniform_attrs_pool_flush_all(struct GHash *table);
76 void DRW_uniform_attrs_pool_clear_all(struct GHash *table);
78  struct GPUUniformAttrList *key);
unsigned int uint
Definition: BLI_sys_types.h:83
GPUBatch
Definition: GPU_batch.h:93
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
GPUPrimType
Definition: GPU_primitive.h:34
struct GPUVertBuf GPUVertBuf
void * DRW_instance_data_next(DRWInstanceData *idata)
void * DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *buffer, int chunk, int item)
void DRW_uniform_attrs_pool_clear_all(struct GHash *table)
void DRW_instance_data_list_free_unused(DRWInstanceDataList *idatalist)
bool DRW_sparse_uniform_buffer_is_empty(DRWSparseUniformBuf *buffer)
DRWInstanceData * DRW_instance_data_request(DRWInstanceDataList *idatalist, uint attr_size)
DRWSparseUniformBuf * DRW_sparse_uniform_buffer_new(unsigned int item_size, unsigned int chunk_size)
void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist)
void DRW_sparse_uniform_buffer_free(DRWSparseUniformBuf *buffer)
GPUVertBuf * DRW_temp_buffer_request(DRWInstanceDataList *idatalist, GPUVertFormat *format, int *vert_len)
struct GHash * DRW_uniform_attrs_pool_new(void)
void DRW_uniform_attrs_pool_flush_all(struct GHash *table)
void DRW_sparse_uniform_buffer_unbind(DRWSparseUniformBuf *buffer, int chunk)
GPUBatch * DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist, GPUVertBuf *buf, GPUBatch *instancer, GPUBatch *geom)
void DRW_sparse_uniform_buffer_bind(DRWSparseUniformBuf *buffer, int chunk, int location)
void DRW_instance_data_list_reset(DRWInstanceDataList *idatalist)
struct DRWSparseUniformBuf * DRW_uniform_attrs_pool_find_ubo(struct GHash *table, struct GPUUniformAttrList *key)
void DRW_sparse_uniform_buffer_clear(DRWSparseUniformBuf *buffer, bool free_all)
void DRW_sparse_uniform_buffer_flush(DRWSparseUniformBuf *buffer)
void DRW_instance_data_list_resize(DRWInstanceDataList *idatalist)
GPUBatch * DRW_temp_batch_request(DRWInstanceDataList *idatalist, GPUVertBuf *buf, GPUPrimType type)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
format
Definition: logImageCore.h:47