84 for (
auto &
v :
batch->inst) {
88 batch->prim_type = prim_type;
90 batch->shader =
nullptr;
99 batch_dst->prim_type = batch_src->prim_type;
101 batch_dst->verts[
v] = batch_src->verts[
v];
149 batch->inst[0] = inst;
174 if (
batch->inst[
v] ==
nullptr) {
176 if (
batch->inst[0]) {
187 BLI_assert(0 &&
"Not enough Instance VBO slot in batch");
198 if (
batch->verts[
v] ==
nullptr) {
200 if (
batch->verts[0] !=
nullptr) {
210 BLI_assert(0 &&
"Not enough VBO slot in batch");
256 GPUBatch *gpu_batch,
int v_first,
int v_count,
int i_first,
int i_count)
263 v_count =
batch->elem_()->index_len_get();
266 v_count =
batch->verts_(0)->vertex_len;
270 i_count = (
batch->inst[0]) ?
batch->inst_(0)->vertex_len : 1;
272 if (
batch->inst[1] !=
nullptr) {
273 i_count =
min_ii(i_count,
batch->inst_(1)->vertex_len);
277 if (v_count == 0 || i_count == 0) {
282 batch->draw(v_first, v_count, i_first, i_count);
MINLINE int min_ii(int a, int b)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define GPU_BATCH_INST_VBO_MAX_LEN
#define GPU_BATCH_VBO_MAX_LEN
@ GPU_BATCH_OWNS_INST_VBO
@ GPU_BATCH_OWNS_INST_VBO_ANY
void gpu_batch_presets_exit(void)
void gpu_batch_presets_init(void)
struct GPUIndexBuf GPUIndexBuf
void GPU_indexbuf_discard(GPUIndexBuf *elem)
struct GPUShader GPUShader
GPUShader * GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, eGPUShaderConfig sh_cfg)
void GPU_shader_bind(GPUShader *shader)
void GPU_vertbuf_discard(GPUVertBuf *)
struct GPUVertBuf GPUVertBuf
#define GPU_VERTBUF_DISCARD_SAFE(verts)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
static Context * get(void)
virtual Batch * batch_alloc(void)=0
static GPUBackend * get(void)
GPUBatch * GPU_batch_calloc(void)
void GPU_batch_discard(GPUBatch *batch)
int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo)
void GPU_batch_init_ex(GPUBatch *batch, GPUPrimType prim_type, GPUVertBuf *verts, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
GPUBatch * GPU_batch_create_ex(GPUPrimType prim_type, GPUVertBuf *verts, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
void GPU_batch_draw_instanced(GPUBatch *batch, int i_count)
void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src)
void GPU_batch_draw_advanced(GPUBatch *gpu_batch, int v_first, int v_count, int i_first, int i_count)
void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader)
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_program_set_builtin_with_config(GPUBatch *batch, eGPUBuiltinShader shader_id, eGPUShaderConfig sh_cfg)
int GPU_batch_instbuf_add_ex(GPUBatch *batch, GPUVertBuf *insts, bool own_vbo)
void GPU_batch_program_set_imm_shader(GPUBatch *batch)
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_instbuf_set(GPUBatch *batch, GPUVertBuf *inst, bool own_vbo)
void gpu_batch_exit(void)
void GPU_batch_clear(GPUBatch *batch)
void GPU_batch_draw(GPUBatch *batch)
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)