diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-04 20:52:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-05 03:26:44 +0300 |
commit | 6be8b6af4006e088ac4a2cd8c1adc8f18c04035b (patch) | |
tree | b1fdd6632646e8cc87015294b6a394087ee54583 /source/blender/draw/engines/eevee/eevee_lightprobes.c | |
parent | d1b3da697d814bcb35a718d2d7c660bd2120cb4b (diff) |
EEVEE: LightCache: Prevent crash when using a lightcache too big
Some implementation have different maximum texture size.
This patch avoid crash when texture allocation fails when:
- trying to bake a lightcache too big for the OpenGL imeplementaion.
- loading a cache from file that is too big for the OpenGL imeplementation.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lightprobes.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 72187dc29eb..a2f7686619f 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -23,6 +23,7 @@ #include "DRW_render.h" #include "BLI_rand.h" +#include "BLI_string_utils.h" #include "BLI_utildefines.h" #include "DNA_image_types.h" @@ -161,6 +162,7 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); + vedata->info[0] = '\0'; if (!e_data.hammersley) { EEVEE_shaders_lightprobe_shaders_init(); @@ -176,6 +178,13 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) stl->g_data->light_cache = scene_eval->eevee.light_cache_data; } else { + if (scene_eval->eevee.light_cache_data && + (scene_eval->eevee.light_cache_data->flag & LIGHTCACHE_NOT_USABLE)) { + /* Error message info. */ + BLI_snprintf( + vedata->info, sizeof(vedata->info), "Error: LightCache cannot be loaded on this GPU"); + } + if (!sldata->fallback_lightcache) { #if defined(IRRADIANCE_SH_L2) int grid_res = 4; |