67 for (
auto &
v :
batch->inst) {
71 batch->prim_type = prim_type;
73 batch->shader =
nullptr;
81 batch_dst->prim_type = batch_src->prim_type;
83 batch_dst->verts[
v] = batch_src->verts[
v];
130 batch->inst[0] = inst;
154 if (
batch->inst[
v] ==
nullptr) {
156 if (
batch->inst[0]) {
177 if (
batch->verts[
v] ==
nullptr) {
179 if (
batch->verts[0] !=
nullptr) {
213 batch->shader = shader;
244 GPUBatch *gpu_batch,
int v_first,
int v_count,
int i_first,
int i_count)
251 v_count =
batch->elem_()->index_len_get();
254 v_count =
batch->verts_(0)->vertex_len;
258 i_count = (
batch->inst[0]) ?
batch->inst_(0)->vertex_len : 1;
260 if (
batch->inst[1] !=
nullptr) {
261 i_count =
min_ii(i_count,
batch->inst_(1)->vertex_len);
265 if (v_count == 0 || i_count == 0) {
270 batch->draw(v_first, v_count, i_first, i_count);
#define BLI_assert_msg(a, msg)
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 GPUBackend * get()
virtual Batch * batch_alloc()=0
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_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)
GPUBatch * GPU_batch_calloc()
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_clear(GPUBatch *batch)
bool GPU_batch_vertbuf_has(GPUBatch *batch, GPUVertBuf *verts)
void GPU_batch_draw(GPUBatch *batch)