diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-04 23:56:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-05 18:49:14 +0300 |
commit | bac4606937514405641659d91a30bf3e6832cdf7 (patch) | |
tree | 740db8bff5e694c2e9f943f928e08030925d0fcf /source/blender/draw/engines | |
parent | 7d4adbdfaba4f23b2adbf96f97ce18806aca31c8 (diff) |
Cleanup: GPUTexture: Remove use of GPU_texture_create_nD
Use creation + update function instead.
Diffstat (limited to 'source/blender/draw/engines')
3 files changed, 25 insertions, 68 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 088a08fb51a..2d846ccd1d6 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -401,16 +401,9 @@ static bool eevee_lightcache_static_load(LightCache *lcache) } if (lcache->grid_tx.tex == NULL) { - lcache->grid_tx.tex = GPU_texture_create_nD(lcache->grid_tx.tex_size[0], - lcache->grid_tx.tex_size[1], - lcache->grid_tx.tex_size[2], - 2, - lcache->grid_tx.data, - IRRADIANCE_FORMAT, - GPU_DATA_UNSIGNED_BYTE, - 0, - false, - NULL); + lcache->grid_tx.tex = GPU_texture_create_2d_array( + UNPACK3(lcache->grid_tx.tex_size), IRRADIANCE_FORMAT, NULL, NULL); + GPU_texture_update(lcache->grid_tx.tex, GPU_DATA_UNSIGNED_BYTE, lcache->grid_tx.data); if (lcache->grid_tx.tex == NULL) { lcache->flag |= LIGHTCACHE_NOT_USABLE; @@ -422,24 +415,17 @@ static bool eevee_lightcache_static_load(LightCache *lcache) if (lcache->cube_tx.tex == NULL) { if (GPU_arb_texture_cube_map_array_is_supported()) { - lcache->cube_tx.tex = GPU_texture_cube_create(lcache->cube_tx.tex_size[0], - lcache->cube_tx.tex_size[2] / 6, - lcache->cube_tx.data, - GPU_R11F_G11F_B10F, - GPU_DATA_10_11_11_REV, - NULL); + lcache->cube_tx.tex = GPU_texture_create_cube_array(lcache->cube_tx.tex_size[0], + lcache->cube_tx.tex_size[2] / 6, + GPU_R11F_G11F_B10F, + NULL, + NULL); + GPU_texture_update(lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, lcache->cube_tx.data); } else { - lcache->cube_tx.tex = GPU_texture_create_nD(lcache->cube_tx.tex_size[0], - lcache->cube_tx.tex_size[1], - lcache->cube_tx.tex_size[2], - 2, - lcache->cube_tx.data, - GPU_R11F_G11F_B10F, - GPU_DATA_10_11_11_REV, - 0, - false, - NULL); + lcache->cube_tx.tex = GPU_texture_create_2d_array( + UNPACK3(lcache->cube_tx.tex_size), GPU_R11F_G11F_B10F, NULL, NULL); + GPU_texture_update(lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, lcache->cube_tx.data); } if (lcache->cube_tx.tex == NULL) { diff --git a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c index b9600ad8caf..ac96a599eb6 100644 --- a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c +++ b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c @@ -56,27 +56,12 @@ void GPENCIL_antialiasing_init(struct GPENCIL_Data *vedata) } if (txl->smaa_search_tx == NULL) { - txl->smaa_search_tx = GPU_texture_create_nD(SEARCHTEX_WIDTH, - SEARCHTEX_HEIGHT, - 0, - 2, - searchTexBytes, - GPU_R8, - GPU_DATA_UNSIGNED_BYTE, - 0, - false, - NULL); - - txl->smaa_area_tx = GPU_texture_create_nD(AREATEX_WIDTH, - AREATEX_HEIGHT, - 0, - 2, - areaTexBytes, - GPU_RG8, - GPU_DATA_UNSIGNED_BYTE, - 0, - false, - NULL); + txl->smaa_search_tx = GPU_texture_create_2d( + SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, GPU_R8, NULL, NULL); + GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes); + + txl->smaa_area_tx = GPU_texture_create_2d(AREATEX_WIDTH, AREATEX_HEIGHT, GPU_RG8, NULL, NULL); + GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes); GPU_texture_filter_mode(txl->smaa_search_tx, true); GPU_texture_filter_mode(txl->smaa_area_tx, true); diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c index 47a03073839..9d5ff47fc82 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c @@ -242,27 +242,13 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata) /* TODO could be shared for all viewports. */ if (txl->smaa_search_tx == NULL) { - txl->smaa_search_tx = GPU_texture_create_nD(SEARCHTEX_WIDTH, - SEARCHTEX_HEIGHT, - 0, - 2, - searchTexBytes, - GPU_R8, - GPU_DATA_UNSIGNED_BYTE, - 0, - false, - NULL); - - txl->smaa_area_tx = GPU_texture_create_nD(AREATEX_WIDTH, - AREATEX_HEIGHT, - 0, - 2, - areaTexBytes, - GPU_RG8, - GPU_DATA_UNSIGNED_BYTE, - 0, - false, - NULL); + txl->smaa_search_tx = GPU_texture_create_2d( + SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, GPU_R8, NULL, NULL); + GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes); + + txl->smaa_area_tx = GPU_texture_create_2d( + AREATEX_WIDTH, AREATEX_HEIGHT, GPU_RG8, NULL, NULL); + GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes); GPU_texture_filter_mode(txl->smaa_search_tx, true); GPU_texture_filter_mode(txl->smaa_area_tx, true); |