Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-09-05 18:33:56 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-05 18:49:14 +0300
commitab95cdaba970a30127d804bd1e66ad25ab021ec1 (patch)
treed0da883e11f81253cb7b3e5a75288ca69598e437 /source/blender/draw/engines/eevee/eevee_lightcache.c
parentbac4606937514405641659d91a30bf3e6832cdf7 (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/draw/engines/eevee/eevee_lightcache.c')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 2d846ccd1d6..49d68481045 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -402,7 +402,7 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
if (lcache->grid_tx.tex == NULL) {
lcache->grid_tx.tex = GPU_texture_create_2d_array(
- UNPACK3(lcache->grid_tx.tex_size), IRRADIANCE_FORMAT, NULL, NULL);
+ "lightcache_irradiance", UNPACK3(lcache->grid_tx.tex_size), 1, IRRADIANCE_FORMAT, NULL);
GPU_texture_update(lcache->grid_tx.tex, GPU_DATA_UNSIGNED_BYTE, lcache->grid_tx.data);
if (lcache->grid_tx.tex == NULL) {
@@ -415,17 +415,19 @@ 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_create_cube_array(lcache->cube_tx.tex_size[0],
+ lcache->cube_tx.tex = GPU_texture_create_cube_array("lightcache_cubemaps",
+ lcache->cube_tx.tex_size[0],
lcache->cube_tx.tex_size[2] / 6,
+ lcache->mips_len + 1,
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_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);
+ lcache->cube_tx.tex = GPU_texture_create_2d_array("lightcache_cubemaps_fallback",
+ UNPACK3(lcache->cube_tx.tex_size),
+ lcache->mips_len + 1,
+ GPU_R11F_G11F_B10F,
+ NULL);
}
if (lcache->cube_tx.tex == NULL) {
@@ -433,9 +435,9 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
return false;
}
- for (int mip = 0; mip < lcache->mips_len; mip++) {
- GPU_texture_add_mipmap(
- lcache->cube_tx.tex, GPU_DATA_10_11_11_REV, mip + 1, lcache->cube_mips[mip].data);
+ for (int mip = 0; mip <= lcache->mips_len; mip++) {
+ const void *data = (mip == 0) ? lcache->cube_tx.data : lcache->cube_mips[mip - 1].data;
+ GPU_texture_update_mipmap(lcache->cube_tx.tex, mip, GPU_DATA_10_11_11_REV, data);
}
GPU_texture_mipmap_mode(lcache->cube_tx.tex, true, true);
}