From 8a7f317666caa41aad0428b5ed3f399cdfbbd816 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 25 Jun 2018 12:32:48 +0200 Subject: Cleanup: Nuke most of G.main from GPU code. --- source/blender/windowmanager/intern/wm_draw.c | 3 ++- source/blender/windowmanager/intern/wm_files_link.c | 4 ++-- source/blender/windowmanager/intern/wm_init_exit.c | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index aa89cd6d1ef..0f8c49c082d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -948,6 +948,7 @@ void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *ar) void wm_draw_update(bContext *C) { + Main *bmain = CTX_data_main(C); wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win; @@ -955,7 +956,7 @@ void wm_draw_update(bContext *C) BKE_subsurf_free_unused_buffers(); #endif - GPU_free_unused_buffers(); + GPU_free_unused_buffers(bmain); for (win = wm->windows.first; win; win = win->next) { #ifdef WIN32 diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 5a92a345117..8e11e548aec 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -455,7 +455,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) } /* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */ - GPU_materials_free(); + GPU_materials_free(bmain); /* XXX TODO: align G.lib with other directory storage (like last opened image etc...) */ BLI_strncpy(G.lib, root, FILE_MAX); @@ -751,7 +751,7 @@ static void lib_relocate_do( DAG_scene_relations_rebuild(bmain, scene); /* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */ - GPU_materials_free(); + GPU_materials_free(bmain); } void WM_lib_reload(Library *lib, bContext *C, ReportList *reports) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 38aa18a029e..449a0a91a01 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -207,10 +207,10 @@ void WM_init(bContext *C, int argc, const char **argv) GPU_init(); - GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + GPU_set_mipmap(G_MAIN, !(U.gameflags & USER_DISABLE_MIPMAP)); GPU_set_linear_mipmap(true); - GPU_set_anisotropic(U.anisotropic_filter); - GPU_set_gpu_mipmapping(U.use_gpu_mipmap); + GPU_set_anisotropic(G_MAIN, U.anisotropic_filter); + GPU_set_gpu_mipmapping(G_MAIN, U.use_gpu_mipmap); #ifdef WITH_OPENSUBDIV BKE_subsurf_osd_init(); @@ -590,7 +590,7 @@ void WM_exit_ext(bContext *C, const bool do_python) #endif GPU_global_buffer_pool_free(); - GPU_free_unused_buffers(); + GPU_free_unused_buffers(G_MAIN); GPU_exit(); } -- cgit v1.2.3