diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-25 17:35:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-25 17:35:08 +0300 |
commit | acf07e73666a4a3edaeeb36489902b9373a9779d (patch) | |
tree | be9893c779d1fcbda25e688e3dc6da0f4cadc627 /source/blender/draw/modes/edit_mesh_mode.c | |
parent | 75a759ea5e9a4b4a52900e6383d67c81b7cbdabe (diff) |
Draw Manager: store context vars per draw
Was performing context access per object for scene, region etc.
While not very slow they don't change during drawing so cache in a struct.
This also makes it possible to draw in views besides the current context.
Diffstat (limited to 'source/blender/draw/modes/edit_mesh_mode.c')
-rw-r--r-- | source/blender/draw/modes/edit_mesh_mode.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 898664e8762..9fe9eef0682 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -232,9 +232,9 @@ static DRWPass *edit_mesh_create_overlay_pass( DRWShadingGroup **r_lverts_shgrp, DRWShadingGroup **r_facedot_shgrp) { GPUShader *tri_sh, *ledge_sh; - const struct bContext *C = DRW_get_context(); - RegionView3D *rv3d = CTX_wm_region_view3d(C); - Scene *scene = CTX_data_scene(C); + const DRWContextState *draw_ctx = DRW_context_state_get(); + RegionView3D *rv3d = draw_ctx->rv3d; + Scene *scene = draw_ctx->scene; ToolSettings *tsettings = scene->toolsettings; if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) { @@ -289,8 +289,8 @@ static void EDIT_MESH_cache_init(void *vedata) EDIT_MESH_StorageList *stl = ((EDIT_MESH_Data *)vedata)->stl; DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); - const struct bContext *C = DRW_get_context(); - View3D *v3d = CTX_wm_view3d(C); + const DRWContextState *draw_ctx = DRW_context_state_get(); + View3D *v3d = draw_ctx->v3d; bool do_zbufclip = ((v3d->flag & V3D_ZBUF_SELECT) == 0); @@ -392,9 +392,9 @@ static void edit_mesh_add_ob_to_pass( static void EDIT_MESH_cache_populate(void *vedata, Object *ob) { EDIT_MESH_StorageList *stl = ((EDIT_MESH_Data *)vedata)->stl; - const struct bContext *C = DRW_get_context(); - View3D *v3d = CTX_wm_view3d(C); - Scene *scene = CTX_data_scene(C); + const DRWContextState *draw_ctx = DRW_context_state_get(); + View3D *v3d = draw_ctx->v3d; + Scene *scene = draw_ctx->scene; Object *obedit = scene->obedit; struct Batch *geom; |