35 #define GPU_BATCH_VBO_MAX_LEN 6
36 #define GPU_BATCH_INST_VBO_MAX_LEN 2
37 #define GPU_BATCH_VAO_STATIC_LEN 3
38 #define GPU_BATCH_VAO_DYN_ALLOC_COUNT 16
64 #define GPU_BATCH_OWNS_NONE GPU_BATCH_INVALID
67 "eGPUBatchFlag: Error: status flags are shadowed by the ownership bits!")
107 #define GPU_batch_create(prim, verts, elem) GPU_batch_create_ex(prim, verts, elem, 0)
108 #define GPU_batch_init(batch, prim, verts, elem) GPU_batch_init_ex(batch, prim, verts, elem, 0)
121 #define GPU_batch_vertbuf_add(batch, verts) GPU_batch_vertbuf_add_ex(batch, verts, false)
132 #define GPU_batch_uniform_1i(batch, name, x) GPU_shader_uniform_1i((batch)->shader, name, x);
133 #define GPU_batch_uniform_1b(batch, name, x) GPU_shader_uniform_1b((batch)->shader, name, x);
134 #define GPU_batch_uniform_1f(batch, name, x) GPU_shader_uniform_1f((batch)->shader, name, x);
135 #define GPU_batch_uniform_2f(batch, name, x, y) GPU_shader_uniform_2f((batch)->shader, name, x, y);
136 #define GPU_batch_uniform_3f(batch, name, x, y, z) \
137 GPU_shader_uniform_3f((batch)->shader, name, x, y, z);
138 #define GPU_batch_uniform_4f(batch, name, x, y, z, w) \
139 GPU_shader_uniform_4f((batch)->shader, name, x, y, z, w);
140 #define GPU_batch_uniform_2fv(batch, name, val) GPU_shader_uniform_2fv((batch)->shader, name, val);
141 #define GPU_batch_uniform_3fv(batch, name, val) GPU_shader_uniform_3fv((batch)->shader, name, val);
142 #define GPU_batch_uniform_4fv(batch, name, val) GPU_shader_uniform_4fv((batch)->shader, name, val);
143 #define GPU_batch_uniform_2fv_array(batch, name, len, val) \
144 GPU_shader_uniform_2fv_array((batch)->shader, name, len, val);
145 #define GPU_batch_uniform_4fv_array(batch, name, len, val) \
146 GPU_shader_uniform_4fv_array((batch)->shader, name, len, val);
147 #define GPU_batch_uniform_mat4(batch, name, val) \
148 GPU_shader_uniform_mat4((batch)->shader, name, val);
149 #define GPU_batch_texture_bind(batch, name, tex) \
150 GPU_texture_bind(tex, GPU_shader_get_texture_binding((batch)->shader, name));
166 typedef struct BatchWithOwnVertexBuffer {
169 } BatchWithOwnVertexBuffer;
171 typedef struct BatchWithOwnElementList {
174 } BatchWithOwnElementList;
176 typedef struct BatchWithOwnVertexBufferAndElementList {
180 } BatchWithOwnVertexBufferAndElementList;
199 #define GPU_BATCH_DISCARD_SAFE(batch) \
201 if (batch != NULL) { \
202 GPU_batch_discard(batch); \
207 #define GPU_BATCH_CLEAR_SAFE(batch) \
209 if (batch != NULL) { \
210 GPU_batch_clear(batch); \
211 memset(batch, 0, sizeof(*(batch))); \
215 #define GPU_BATCH_DISCARD_ARRAY_SAFE(_batch_array, _len) \
217 if (_batch_array != NULL) { \
218 BLI_assert(_len > 0); \
219 for (int _i = 0; _i < _len; _i++) { \
220 GPU_BATCH_DISCARD_SAFE(_batch_array[_i]); \
222 MEM_freeN(_batch_array); \
#define ENUM_OPERATORS(_type, _max)
GPUBatch * GPU_batch_calloc(void)
void GPU_batch_draw_instanced(GPUBatch *batch, int i_count)
void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src)
BLI_STATIC_ASSERT(GPU_BATCH_OWNS_INDEX< GPU_BATCH_INIT, "eGPUBatchFlag: Error: status flags are shadowed by the ownership bits!") typedef struct GPUBatch
void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader)
void GPU_batch_init_ex(GPUBatch *batch, GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
void GPU_batch_draw_range(GPUBatch *batch, int v_first, int v_count)
void gpu_batch_init(void)
void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo)
void GPU_batch_discard(GPUBatch *)
void GPU_batch_program_set_builtin_with_config(GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg)
void GPU_batch_draw_advanced(GPUBatch *, int v_first, int v_count, int i_first, int i_count)
int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo)
#define GPU_BATCH_INST_VBO_MAX_LEN
void GPU_batch_program_set_imm_shader(GPUBatch *batch)
#define GPU_BATCH_VBO_MAX_LEN
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_clear(GPUBatch *)
int GPU_batch_instbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo)
void gpu_batch_exit(void)
void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo)
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
void GPU_batch_draw(GPUBatch *batch)
@ GPU_BATCH_OWNS_INST_VBO
@ GPU_BATCH_OWNS_INST_VBO_MAX
@ GPU_BATCH_OWNS_INST_VBO_ANY
struct GPUIndexBuf GPUIndexBuf
struct GPUShader GPUShader
struct GPUVertBuf GPUVertBuf
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)