diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-13 06:30:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-13 06:37:27 +0300 |
commit | 64660b902c3fb52fe5a3cb5bf232f90283db8732 (patch) | |
tree | c9549b247ca35e92c3f03db4f07d95aaede60e48 /source/blender/draw/engines/eevee/eevee_lights.c | |
parent | c080702e73f1729897033343d44198488b6fed9f (diff) |
Use 'safe' macros for common free operation
Same as MEM_SAFE_FREE macro,
checks for NULL, runs free then sets NULL.
Blocks of code that do this many times are noisy and likely
errors here wouldn't be noticed immediately.
Also NULL's static vars which were being left set.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lights.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lights.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index 9a06c665ae2..3dc1f7cb48f 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -125,24 +125,15 @@ void EEVEE_lights_cache_finish(EEVEE_StorageList *stl, EEVEE_TextureList *txl, E /* Step 5 Setup enough layers */ /* Free textures if number mismatch */ if (linfo->num_cube != linfo->cache_num_cube) { - if (txl->shadow_depth_cube_pool) { - DRW_texture_free(txl->shadow_depth_cube_pool); - txl->shadow_depth_cube_pool = NULL; - } + DRW_TEXTURE_FREE_SAFE(txl->shadow_depth_cube_pool); linfo->cache_num_cube = linfo->num_cube; } if (linfo->num_map != linfo->cache_num_map) { - if (txl->shadow_depth_map_pool) { - DRW_texture_free(txl->shadow_depth_map_pool); - txl->shadow_depth_map_pool = NULL; - } + DRW_TEXTURE_FREE_SAFE(txl->shadow_depth_map_pool); linfo->cache_num_map = linfo->num_map; } if (linfo->num_cascade != linfo->cache_num_cascade) { - if (txl->shadow_depth_cascade_pool) { - DRW_texture_free(txl->shadow_depth_cascade_pool); - txl->shadow_depth_cascade_pool = NULL; - } + DRW_TEXTURE_FREE_SAFE(txl->shadow_depth_cascade_pool); linfo->cache_num_cascade = linfo->num_cascade; } |