Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/GPU_batch.h
| Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| typedef struct GPUBatch { | typedef struct GPUBatch { | ||||
| /** verts[0] is required, others can be NULL */ | /** verts[0] is required, others can be NULL */ | ||||
| GPUVertBuf *verts[GPU_BATCH_VBO_MAX_LEN]; | GPUVertBuf *verts[GPU_BATCH_VBO_MAX_LEN]; | ||||
| /** Instance attributes. */ | /** Instance attributes. */ | ||||
| GPUVertBuf *inst[GPU_BATCH_INST_VBO_MAX_LEN]; | GPUVertBuf *inst[GPU_BATCH_INST_VBO_MAX_LEN]; | ||||
| /** NULL if element list not needed */ | /** NULL if element list not needed */ | ||||
| GPUIndexBuf *elem; | GPUIndexBuf *elem; | ||||
| /** Resource ID attribute workaround. */ | |||||
| GPUStorageBuf *resource_id_buf; | |||||
| /** Bookkeeping. */ | /** Bookkeeping. */ | ||||
| eGPUBatchFlag flag; | eGPUBatchFlag flag; | ||||
| /** Type of geometry to draw. */ | /** Type of geometry to draw. */ | ||||
| GPUPrimType prim_type; | GPUPrimType prim_type; | ||||
| /** Current assigned shader. DEPRECATED. Here only for uniform binding. */ | /** Current assigned shader. DEPRECATED. Here only for uniform binding. */ | ||||
| struct GPUShader *shader; | struct GPUShader *shader; | ||||
| } GPUBatch; | } GPUBatch; | ||||
| Show All 40 Lines | |||||
| /** | /** | ||||
| * Returns the index of verts in the batch. | * Returns the index of verts in the batch. | ||||
| */ | */ | ||||
| int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo); | int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo); | ||||
| bool GPU_batch_vertbuf_has(GPUBatch *, GPUVertBuf *); | bool GPU_batch_vertbuf_has(GPUBatch *, GPUVertBuf *); | ||||
| #define GPU_batch_vertbuf_add(batch, verts) GPU_batch_vertbuf_add_ex(batch, verts, false) | #define GPU_batch_vertbuf_add(batch, verts) GPU_batch_vertbuf_add_ex(batch, verts, false) | ||||
| /** | |||||
| * Set resource id buffer to bind as instance attribute to workaround the lack of gl_BaseInstance. | |||||
| */ | |||||
| void GPU_batch_resource_id_buf_set(GPUBatch *batch, GPUStorageBuf *resource_id_buf); | |||||
| void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader); | void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader); | ||||
| /** | /** | ||||
| * Bind program bound to IMM to the batch. | * Bind program bound to IMM to the batch. | ||||
| * | * | ||||
| * XXX Use this with much care. Drawing with the #GPUBatch API is not compatible with IMM. | * XXX Use this with much care. Drawing with the #GPUBatch API is not compatible with IMM. | ||||
| * DO NOT DRAW WITH THE BATCH BEFORE CALLING #immUnbindProgram. | * DO NOT DRAW WITH THE BATCH BEFORE CALLING #immUnbindProgram. | ||||
| */ | */ | ||||
| void GPU_batch_program_set_imm_shader(GPUBatch *batch); | void GPU_batch_program_set_imm_shader(GPUBatch *batch); | ||||
| ▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines | |||||