diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-05 18:33:56 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-05 18:49:14 +0300 |
commit | ab95cdaba970a30127d804bd1e66ad25ab021ec1 (patch) | |
tree | d0da883e11f81253cb7b3e5a75288ca69598e437 /source/blender/blenkernel/intern | |
parent | bac4606937514405641659d91a30bf3e6832cdf7 (diff) |
GPUTexture: Change texture creation API
This is to modernize the API:
- Add meaningful name to all textures (except DRW textures).
- Remove unused err_out argument: only used for offscreen python.
- Add mipmap count to creation functions for future changes.
- Clarify the data usage in creation functions.
This is a cleanup commit, there is no functional change.
# Conflicts:
# source/blender/gpu/GPU_texture.h
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/image_gpu.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c index 0a6015a3933..183129bf9b6 100644 --- a/source/blender/blenkernel/intern/image_gpu.c +++ b/source/blender/blenkernel/intern/image_gpu.c @@ -95,7 +95,7 @@ static GPUTexture *gpu_texture_create_tile_mapping(Image *ima, const int multivi tile_info[3] = tile->runtime.tilearray_size[1] / array_h; } - GPUTexture *tex = GPU_texture_create_1d_array(width, 2, GPU_RGBA32F, data, NULL); + GPUTexture *tex = GPU_texture_create_1d_array(ima->id.name + 2, width, 2, 1, GPU_RGBA32F, data); GPU_texture_mipmap_mode(tex, false, false); MEM_freeN(data); @@ -180,7 +180,7 @@ static GPUTexture *gpu_texture_create_tile_array(Image *ima, ImBuf *main_ibuf) const bool use_high_bitdepth = (ima->flag & IMA_HIGH_BITDEPTH); /* Create Texture without content. */ GPUTexture *tex = IMB_touch_gpu_texture( - main_ibuf, arraywidth, arrayheight, arraylayers, use_high_bitdepth); + ima->id.name + 2, main_ibuf, arraywidth, arrayheight, arraylayers, use_high_bitdepth); /* Upload each tile one by one. */ LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) { @@ -316,7 +316,8 @@ static GPUTexture *image_get_gpu_texture(Image *ima, (ima ? (ima->alpha_mode != IMA_ALPHA_STRAIGHT) : false) : (ima ? (ima->alpha_mode == IMA_ALPHA_PREMUL) : true); - *tex = IMB_create_gpu_texture(ibuf_intern, use_high_bitdepth, store_premultiplied); + *tex = IMB_create_gpu_texture( + ima->id.name + 2, ibuf_intern, use_high_bitdepth, store_premultiplied); if (GPU_mipmap_enabled()) { GPU_texture_generate_mipmap(*tex); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 55e43a2b8ed..3865407b0a7 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1924,7 +1924,7 @@ GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser) /* This only means RGBA16F instead of RGBA32F. */ const bool high_bitdepth = false; const bool store_premultiplied = ibuf->rect_float ? false : true; - *tex = IMB_create_gpu_texture(ibuf, high_bitdepth, store_premultiplied); + *tex = IMB_create_gpu_texture(clip->id.name + 2, ibuf, high_bitdepth, store_premultiplied); /* Do not generate mips for movieclips... too slow. */ GPU_texture_mipmap_mode(*tex, false, true); diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index e08d301e5a6..95186d2311a 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -500,7 +500,7 @@ static void studiolight_create_equirect_radiance_gputexture(StudioLight *sl) ImBuf *ibuf = sl->equirect_radiance_buffer; sl->equirect_radiance_gputexture = GPU_texture_create_2d( - ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, NULL); + "studiolight_radiance", ibuf->x, ibuf->y, 1, GPU_RGBA16F, ibuf->rect_float); GPUTexture *tex = sl->equirect_radiance_gputexture; GPU_texture_filter_mode(tex, true); GPU_texture_wrap_mode(tex, true, true); @@ -520,7 +520,7 @@ static void studiolight_create_matcap_gputexture(StudioLightImage *sli) copy_v3_v3(*offset3, *offset4); } - sli->gputexture = GPU_texture_create_2d(ibuf->x, ibuf->y, GPU_R11F_G11F_B10F, NULL, NULL); + sli->gputexture = GPU_texture_create_2d("matcap", ibuf->x, ibuf->y, 1, GPU_R11F_G11F_B10F, NULL); GPU_texture_update(sli->gputexture, GPU_DATA_FLOAT, gpu_matcap_3components); MEM_SAFE_FREE(gpu_matcap_3components); @@ -555,7 +555,7 @@ static void studiolight_create_equirect_irradiance_gputexture(StudioLight *sl) BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECT_IRRADIANCE_IMAGE_CALCULATED); ImBuf *ibuf = sl->equirect_irradiance_buffer; sl->equirect_irradiance_gputexture = GPU_texture_create_2d( - ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, NULL); + "studiolight_irradiance", ibuf->x, ibuf->y, 1, GPU_RGBA16F, ibuf->rect_float); GPUTexture *tex = sl->equirect_irradiance_gputexture; GPU_texture_filter_mode(tex, true); GPU_texture_wrap_mode(tex, true, true); |