diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-26 21:20:03 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-26 22:07:25 +0300 |
commit | 54237994d8b4fd199dc8a616685638b39e7e278d (patch) | |
tree | 0fce384c32a42a489afdcdae803fee086fb60c10 /source | |
parent | 487eaeed7e3da6bbadc7899062574ef9b62ab7e4 (diff) |
Cleanup: Image: Rename redundant enum for clarity
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 15 | ||||
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_data.c | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_image.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_paint.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_materials.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture_image.cc | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_image_types.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 4 |
10 files changed, 36 insertions, 38 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index e42a1c58985..042a5233978 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3351,8 +3351,7 @@ static void image_free_tile(Image *ima, ImageTile *tile) for (int i = 0; i < TEXTARGET_COUNT; i++) { /* Only two textures depends on all tiles, so if this is a secondary tile we can keep the other * two. */ - if (tile != ima->tiles.first && - !(ELEM(i, TEXTARGET_TEXTURE_2D_ARRAY, TEXTARGET_TEXTURE_TILE_MAPPING))) { + if (tile != ima->tiles.first && !(ELEM(i, TEXTARGET_2D_ARRAY, TEXTARGET_TILE_MAPPING))) { continue; } @@ -3629,13 +3628,13 @@ ImageTile *BKE_image_add_tile(struct Image *ima, int tile_number, const char *la for (int eye = 0; eye < 2; eye++) { /* Reallocate GPU tile array. */ - if (ima->gputexture[TEXTARGET_TEXTURE_2D_ARRAY][eye] != NULL) { - GPU_texture_free(ima->gputexture[TEXTARGET_TEXTURE_2D_ARRAY][eye]); - ima->gputexture[TEXTARGET_TEXTURE_2D_ARRAY][eye] = NULL; + if (ima->gputexture[TEXTARGET_2D_ARRAY][eye] != NULL) { + GPU_texture_free(ima->gputexture[TEXTARGET_2D_ARRAY][eye]); + ima->gputexture[TEXTARGET_2D_ARRAY][eye] = NULL; } - if (ima->gputexture[TEXTARGET_TEXTURE_TILE_MAPPING][eye] != NULL) { - GPU_texture_free(ima->gputexture[TEXTARGET_TEXTURE_TILE_MAPPING][eye]); - ima->gputexture[TEXTARGET_TEXTURE_TILE_MAPPING][eye] = NULL; + if (ima->gputexture[TEXTARGET_TILE_MAPPING][eye] != NULL) { + GPU_texture_free(ima->gputexture[TEXTARGET_TILE_MAPPING][eye]); + ima->gputexture[TEXTARGET_TILE_MAPPING][eye] = NULL; } } diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c index b72ad5a2960..d2aa0a45660 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c @@ -63,7 +63,7 @@ static struct GPUTexture *gpencil_image_texture_get(Image *image, bool *r_alpha_ ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); if (ibuf != NULL && ibuf->rect != NULL) { - gpu_tex = GPU_texture_from_blender(image, &iuser, ibuf, TEXTARGET_TEXTURE_2D); + gpu_tex = GPU_texture_from_blender(image, &iuser, ibuf, TEXTARGET_2D); *r_alpha_premult = (image->alpha_mode == IMA_ALPHA_PREMUL); } BKE_image_release_ibuf(image, ibuf, lock); diff --git a/source/blender/draw/engines/overlay/overlay_image.c b/source/blender/draw/engines/overlay/overlay_image.c index 8a91bf51c2a..7aad84629e0 100644 --- a/source/blender/draw/engines/overlay/overlay_image.c +++ b/source/blender/draw/engines/overlay/overlay_image.c @@ -175,7 +175,7 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp } width = ibuf->x; height = ibuf->y; - tex = GPU_texture_from_blender(image, iuser, ibuf, TEXTARGET_TEXTURE_2D); + tex = GPU_texture_from_blender(image, iuser, ibuf, TEXTARGET_2D); BKE_image_release_ibuf(image, ibuf, lock); iuser->scene = NULL; @@ -203,7 +203,7 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp } BKE_movieclip_user_set_frame(&bgpic->cuser, ctime); - tex = GPU_texture_from_movieclip(clip, &bgpic->cuser, TEXTARGET_TEXTURE_2D); + tex = GPU_texture_from_movieclip(clip, &bgpic->cuser, TEXTARGET_2D); if (tex == NULL) { return NULL; } @@ -383,7 +383,7 @@ void OVERLAY_image_empty_cache_populate(OVERLAY_Data *vedata, Object *ob) if (ima != NULL) { ImageUser iuser = *ob->iuser; camera_background_images_stereo_setup(draw_ctx->scene, draw_ctx->v3d, ima, &iuser); - tex = GPU_texture_from_blender(ima, &iuser, NULL, TEXTARGET_TEXTURE_2D); + tex = GPU_texture_from_blender(ima, &iuser, NULL, TEXTARGET_2D); if (tex) { size[0] = GPU_texture_orig_width(tex); size[1] = GPU_texture_orig_height(tex); diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c index d0272050402..44eded94e63 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.c +++ b/source/blender/draw/engines/overlay/overlay_paint.c @@ -136,8 +136,7 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata) state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA; DRW_PASS_CREATE(psl->paint_color_ps, state | pd->clipping_state); - GPUTexture *tex = GPU_texture_from_blender( - imapaint->stencil, NULL, NULL, TEXTARGET_TEXTURE_2D); + GPUTexture *tex = GPU_texture_from_blender(imapaint->stencil, NULL, NULL, TEXTARGET_2D); const bool mask_premult = (imapaint->stencil->alpha_mode == IMA_ALPHA_PREMUL); const bool mask_inverted = (imapaint->flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) != 0; diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 33b0764160f..0493b42f9c6 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -261,11 +261,11 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd, if (ima) { if (ima->source == IMA_SRC_TILED) { - tex = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_TEXTURE_2D_ARRAY); - tex_tile_data = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_TEXTURE_TILE_MAPPING); + tex = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_2D_ARRAY); + tex_tile_data = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_TILE_MAPPING); } else { - tex = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_TEXTURE_2D); + tex = GPU_texture_from_blender(ima, iuser, NULL, TEXTARGET_2D); } } diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 2eac3c6f64d..e3d0dcdf65b 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -1189,10 +1189,10 @@ GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat tex_format, const GLuint static GLenum convert_target_to_gl(int target) { static const GLenum table[] = { - [TEXTARGET_TEXTURE_2D] = GL_TEXTURE_2D, - [TEXTARGET_TEXTURE_CUBE_MAP] = GL_TEXTURE_CUBE_MAP, - [TEXTARGET_TEXTURE_2D_ARRAY] = GL_TEXTURE_2D_ARRAY, - [TEXTARGET_TEXTURE_TILE_MAPPING] = GL_TEXTURE_1D_ARRAY, + [TEXTARGET_2D] = GL_TEXTURE_2D, + [TEXTARGET_CUBE_MAP] = GL_TEXTURE_CUBE_MAP, + [TEXTARGET_2D_ARRAY] = GL_TEXTURE_2D_ARRAY, + [TEXTARGET_TILE_MAPPING] = GL_TEXTURE_1D_ARRAY, }; return table[target]; } diff --git a/source/blender/gpu/intern/gpu_texture_image.cc b/source/blender/gpu/intern/gpu_texture_image.cc index 4b091ecc618..bbc54651b87 100644 --- a/source/blender/gpu/intern/gpu_texture_image.cc +++ b/source/blender/gpu/intern/gpu_texture_image.cc @@ -195,7 +195,7 @@ static GPUTexture **gpu_get_image_gputexture(Image *ima, int textarget, const in static uint gpu_texture_create_tile_mapping(Image *ima, const int multiview_eye) { - GPUTexture *tilearray = ima->gputexture[TEXTARGET_TEXTURE_2D_ARRAY][multiview_eye]; + GPUTexture *tilearray = ima->gputexture[TEXTARGET_2D_ARRAY][multiview_eye]; if (tilearray == NULL) { return 0; @@ -559,10 +559,10 @@ static GPUTexture **gpu_get_movieclip_gputexture(MovieClip *clip, } if (textarget == GL_TEXTURE_2D) { - return &tex->gputexture[TEXTARGET_TEXTURE_2D]; + return &tex->gputexture[TEXTARGET_2D]; } else if (textarget == GL_TEXTURE_CUBE_MAP) { - return &tex->gputexture[TEXTARGET_TEXTURE_CUBE_MAP]; + return &tex->gputexture[TEXTARGET_CUBE_MAP]; } } } @@ -886,10 +886,10 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, ImBuf *ibuf, } } - if (textarget == TEXTARGET_TEXTURE_2D_ARRAY) { + if (textarget == TEXTARGET_2D_ARRAY) { bindcode = gpu_texture_create_tile_array(ima, ibuf_intern); } - else if (textarget == TEXTARGET_TEXTURE_TILE_MAPPING) { + else if (textarget == TEXTARGET_TILE_MAPPING) { bindcode = gpu_texture_create_tile_mapping(ima, iuser ? iuser->multiview_eye : 0); } else { @@ -905,7 +905,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, ImBuf *ibuf, GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y); - if (textarget == TEXTARGET_TEXTURE_TILE_MAPPING) { + if (textarget == TEXTARGET_TILE_MAPPING) { /* Special for tile mapping. */ GPU_texture_mipmap_mode(*tex, false, false); } @@ -1265,7 +1265,7 @@ void GPU_paint_set_mipmap(Main *bmain, bool mipmap) if (ima->gpuflag & IMA_GPU_MIPMAP_COMPLETE) { for (int eye = 0; eye < 2; eye++) { for (int a = 0; a < TEXTARGET_COUNT; a++) { - if (ELEM(a, TEXTARGET_TEXTURE_2D, TEXTARGET_TEXTURE_2D_ARRAY)) { + if (ELEM(a, TEXTARGET_2D, TEXTARGET_2D_ARRAY)) { GPUTexture *tex = ima->gputexture[a][eye]; if (tex != NULL) { GPU_texture_bind(tex, 0); @@ -1291,7 +1291,7 @@ void GPU_paint_set_mipmap(Main *bmain, bool mipmap) if (BKE_image_has_opengl_texture(ima)) { for (int eye = 0; eye < 2; eye++) { for (int a = 0; a < TEXTARGET_COUNT; a++) { - if (ELEM(a, TEXTARGET_TEXTURE_2D, TEXTARGET_TEXTURE_2D_ARRAY)) { + if (ELEM(a, TEXTARGET_2D, TEXTARGET_2D_ARRAY)) { GPUTexture *tex = ima->gputexture[a][eye]; if (tex != NULL) { GPU_texture_bind(tex, 0); @@ -1322,14 +1322,14 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i GPU_free_image(ima); } - GPUTexture *tex = ima->gputexture[TEXTARGET_TEXTURE_2D][0]; + GPUTexture *tex = ima->gputexture[TEXTARGET_2D][0]; /* Check if we need to update the main gputexture. */ if (tex != NULL && tile == ima->tiles.first) { gpu_texture_update_from_ibuf(tex, ima, ibuf, NULL, x, y, w, h); } /* Check if we need to update the array gputexture. */ - tex = ima->gputexture[TEXTARGET_TEXTURE_2D_ARRAY][0]; + tex = ima->gputexture[TEXTARGET_2D_ARRAY][0]; if (tex != NULL) { gpu_texture_update_from_ibuf(tex, ima, ibuf, tile, x, y, w, h); } diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index ba40ef1c2bc..d01933348de 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -118,10 +118,10 @@ typedef struct ImageTile { #define IMA_SHOW_STEREO (1 << 4) enum { - TEXTARGET_TEXTURE_2D = 0, - TEXTARGET_TEXTURE_CUBE_MAP, - TEXTARGET_TEXTURE_2D_ARRAY, - TEXTARGET_TEXTURE_TILE_MAPPING, + TEXTARGET_2D = 0, + TEXTARGET_CUBE_MAP, + TEXTARGET_2D_ARRAY, + TEXTARGET_TILE_MAPPING, TEXTARGET_COUNT, }; diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 887bded8540..e0bcdc504fb 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -398,7 +398,7 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values) static int rna_Image_bindcode_get(PointerRNA *ptr) { Image *ima = (Image *)ptr->data; - GPUTexture *tex = ima->gputexture[TEXTARGET_TEXTURE_2D][0]; + GPUTexture *tex = ima->gputexture[TEXTARGET_2D][0]; return (tex) ? GPU_texture_opengl_bindcode(tex) : 0; } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index fecd364992b..a9a62c8d8b4 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -222,7 +222,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_TEXTURE_2D); + GPUTexture *tex = GPU_texture_from_blender(image, &iuser, NULL, TEXTARGET_2D); if (tex == NULL) { BKE_reportf(reports, RPT_ERROR, "Failed to load image texture '%s'", image->id.name + 2); @@ -239,7 +239,7 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) BKE_image_tag_time(image); - if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL) { + if (image->gputexture[TEXTARGET_2D] == NULL) { error = rna_Image_gl_load(image, reports, frame); } |