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/intern/draw_manager_texture.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/intern/draw_manager_texture.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager_texture.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_manager_texture.c b/source/blender/draw/intern/draw_manager_texture.c index 77b0462303d..b94a6db3bad 100644 --- a/source/blender/draw/intern/draw_manager_texture.c +++ b/source/blender/draw/intern/draw_manager_texture.c @@ -61,6 +61,10 @@ static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format) void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags) { + if (tex == NULL) { + return; + } + if (flags & DRW_TEX_MIPMAP) { GPU_texture_mipmap_mode(tex, true, flags & DRW_TEX_FILTER); GPU_texture_bind(tex, 0); @@ -119,7 +123,6 @@ GPUTexture *DRW_texture_create_cube(int w, { GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL); drw_texture_set_parameters(tex, flags); - return tex; } @@ -128,7 +131,6 @@ GPUTexture *DRW_texture_create_cube_array( { GPUTexture *tex = GPU_texture_create_cube_array(w, d, format, fpixels, NULL); drw_texture_set_parameters(tex, flags); - return tex; } |