From 6be8b6af4006e088ac4a2cd8c1adc8f18c04035b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 4 Aug 2020 19:52:18 +0200 Subject: 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. --- source/blender/editors/render/render_shading.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 536252f5003..711f89b9fda 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -945,6 +945,11 @@ static int light_cache_bake_modal(bContext *C, wmOperator *op, const wmEvent *ev /* no running blender, remove handler and pass through */ if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) { + LightCache *lcache = scene->eevee.light_cache_data; + if (lcache && (lcache->flag & LIGHTCACHE_INVALID)) { + BKE_report(op->reports, RPT_ERROR, "Lightcache cannot allocate resources"); + return OPERATOR_CANCELLED; + } return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; } -- cgit v1.2.3