From 5f6fb5bb41ed0057f0e2f0ccded717fbf04e55e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 29 Jul 2020 18:13:19 +0200 Subject: Cleanup: Split gpu_texture_image.c into BKE and IMB modules This is in order to disolve GPU_draw.h into more meaningful code blocks. All the Image related function are in `image_gpu.c`. All the MovieClip related function are in `movieclip.c`. The IMB module now has a connection with GPU. This is not strickly necessary and the code could be move to `image_gpu.c` if needed. The Image garbage collection is also ported to `image_gpu.c`. --- source/blender/makesrna/intern/rna_image.c | 4 ++-- source/blender/makesrna/intern/rna_image_api.c | 4 ++-- source/blender/makesrna/intern/rna_userdef.c | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index e0bcdc504fb..23f9f70e470 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -200,7 +200,7 @@ static void rna_Image_gpu_texture_update(Main *UNUSED(bmain), Image *ima = (Image *)ptr->owner_id; if (!G.background) { - GPU_free_image(ima); + BKE_image_free_gputextures(ima); } WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); @@ -516,7 +516,7 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values) ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID; BKE_image_mark_dirty(ima, ibuf); if (!G.background) { - GPU_free_image(ima); + BKE_image_free_gputextures(ima); } WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id); } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index a57efbcf1b3..6f876923e52 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -220,7 +220,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame) BKE_imageuser_default(&iuser); iuser.framenr = frame; - GPUTexture *tex = GPU_texture_from_blender(image, &iuser, NULL, TEXTARGET_2D); + GPUTexture *tex = BKE_image_get_gpu_texture(image, &iuser, NULL); if (tex == NULL) { BKE_reportf(reports, RPT_ERROR, "Failed to load image texture '%s'", image->id.name + 2); @@ -246,7 +246,7 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) static void rna_Image_gl_free(Image *image) { - GPU_free_image(image); + BKE_image_free_gputextures(image); /* remove the nocollect flag, image is available for garbage collection again */ image->flag &= ~IMA_NOCOLLECT; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b13b9f5c11d..490bcb88f22 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -179,6 +179,7 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = { # include "BKE_blender.h" # include "BKE_global.h" # include "BKE_idprop.h" +# include "BKE_image.h" # include "BKE_main.h" # include "BKE_mesh_runtime.h" # include "BKE_paint.h" @@ -371,7 +372,7 @@ static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - GPU_free_images(bmain); + BKE_image_free_all_gputextures(bmain); rna_userdef_update(bmain, scene, ptr); } -- cgit v1.2.3