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-08-05 03:26:16 +0300
committerJeroen Bakker <jeroen@blender.org>2020-08-12 10:25:10 +0300
commit16b4b412e6b380eb92b5e66d7ba932f715943f28 (patch)
tree3c5f4111bdac585eb64ec3052b3a833301ea8c0e
parent220470be1515d90ae2c3157648bd9da311925427 (diff)
EEVEE: LightCache: Add warning if the cache cannot be saved
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 614c749b9aa..bb23e898f38 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -206,6 +206,21 @@ static bool eevee_lightcache_version_check(LightCache *lcache)
}
}
+static bool eevee_lightcache_can_be_saved(LightCache *lcache)
+{
+ if (lcache->grid_tx.data) {
+ if (MEM_allocN_len(lcache->grid_tx.data) >= INT_MAX) {
+ return false;
+ }
+ }
+ if (lcache->cube_tx.data) {
+ if (MEM_allocN_len(lcache->cube_tx.data) >= INT_MAX) {
+ return false;
+ }
+ }
+ return true;
+}
+
static int eevee_lightcache_irradiance_sample_count(LightCache *lcache)
{
int total_irr_samples = 0;
@@ -242,6 +257,13 @@ void EEVEE_lightcache_info_update(SceneEEVEE *eevee)
return;
}
+ if (!eevee_lightcache_can_be_saved(lcache)) {
+ BLI_strncpy(eevee->light_cache_info,
+ TIP_("Error: LightCache is too large and will not be saved to disk"),
+ sizeof(eevee->light_cache_info));
+ return;
+ }
+
char formatted_mem[15];
BLI_str_format_byte_unit(formatted_mem, eevee_lightcache_memsize_get(lcache), false);