diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-08-13 17:57:42 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-08-13 17:57:42 +0300 |
commit | 735c717a63c8870d2ef4a910d82a2648cbaaa5e1 (patch) | |
tree | 4cff1cfe01053b8cc188cc69e1c2c60946fe37cc /source/blender/draw/intern/draw_manager_exec.c | |
parent | cba7391d4a42a44efeddae3ff717e542a3c73738 (diff) | |
parent | 53683dec7d9ac9f324ff91904c9f80b8018b9b9c (diff) |
Merge branch 'master' into greasepencil-edit-curve
Diffstat (limited to 'source/blender/draw/intern/draw_manager_exec.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index e3860b1bfb2..b931bdd0cbe 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -54,8 +54,6 @@ typedef struct DRWCommandsState { int resource_id; int base_inst; int inst_count; - int v_first; - int v_count; bool neg_scale; /* Resource location. */ int obmats_loc; @@ -663,18 +661,9 @@ BLI_INLINE void draw_legacy_matrix_update(DRWShadingGroup *shgroup, BLI_INLINE void draw_geometry_bind(DRWShadingGroup *shgroup, GPUBatch *geom) { - /* XXX hacking #GPUBatch. we don't want to call glUseProgram! (huge performance loss) */ - if (DST.batch) { - DST.batch->program_in_use = false; - } - DST.batch = geom; - GPU_batch_set_shader_no_bind(geom, shgroup->shader); - - geom->program_in_use = true; /* XXX hacking #GPUBatch */ - - GPU_batch_bind(geom); + GPU_batch_set_shader(geom, shgroup->shader); } BLI_INLINE void draw_geometry_execute(DRWShadingGroup *shgroup, @@ -714,18 +703,12 @@ BLI_INLINE void draw_indirect_call(DRWShadingGroup *shgroup, DRWCommandsState *s GPU_draw_list_submit(DST.draw_list); draw_geometry_bind(shgroup, state->batch); } - GPU_draw_list_command_add( - DST.draw_list, state->v_first, state->v_count, state->base_inst, state->inst_count); + GPU_draw_list_append(DST.draw_list, state->batch, state->base_inst, state->inst_count); } /* Fallback when unsupported */ else { - draw_geometry_execute(shgroup, - state->batch, - state->v_first, - state->v_count, - state->base_inst, - state->inst_count, - state->baseinst_loc); + draw_geometry_execute( + shgroup, state->batch, 0, 0, state->base_inst, state->inst_count, state->baseinst_loc); } } @@ -873,10 +856,10 @@ BLI_INLINE void draw_select_buffer(DRWShadingGroup *shgroup, /* Batching */ if (!is_instancing) { /* FIXME: Meh a bit nasty. */ - if (batch->gl_prim_type == convert_prim_type_to_gl(GPU_PRIM_TRIS)) { + if (batch->prim_type == GPU_PRIM_TRIS) { count = 3; } - else if (batch->gl_prim_type == convert_prim_type_to_gl(GPU_PRIM_LINES)) { + else if (batch->prim_type == GPU_PRIM_LINES) { count = 2; } } @@ -1015,8 +998,6 @@ static void draw_call_batching_start(DRWCommandsState *state) state->resource_id = -1; state->base_inst = 0; state->inst_count = 0; - state->v_first = 0; - state->v_count = 0; state->batch = NULL; state->select_id = -1; @@ -1039,15 +1020,10 @@ static void draw_call_batching_do(DRWShadingGroup *shgroup, draw_call_batching_flush(shgroup, state); state->batch = call->batch; - state->v_first = (call->batch->elem) ? call->batch->elem->index_start : 0; - state->v_count = (call->batch->elem) ? call->batch->elem->index_len : - call->batch->verts[0]->vertex_len; state->inst_count = 1; state->base_inst = id; draw_call_resource_bind(state, &call->handle); - - GPU_draw_list_init(DST.draw_list, state->batch); } /* Is the id consecutive? */ else if (id != state->base_inst + state->inst_count) { @@ -1111,10 +1087,6 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) } GPU_shader_bind(shgroup->shader); DST.shader = shgroup->shader; - /* XXX hacking gawain */ - if (DST.batch) { - DST.batch->program_in_use = false; - } DST.batch = NULL; } @@ -1305,7 +1277,6 @@ static void drw_draw_pass_ex(DRWPass *pass, } if (DST.batch) { - DST.batch->program_in_use = false; DST.batch = NULL; } |