diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-08-30 23:47:36 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-08-30 23:49:05 +0300 |
commit | f436e0acab6cb510a74fe9e04b7dfb1c2ac142b5 (patch) | |
tree | edae4e385c9018ab7f4586e1edededcd1841d719 /source/blender/gpu/GPU_batch.h | |
parent | 7527f2317a01b911638c0db5df2661241c31c7b0 (diff) |
Cleanup: GPU_BATCH_DISCARD_ARRAY_SAFE (deduplicate existing code)
Diffstat (limited to 'source/blender/gpu/GPU_batch.h')
-rw-r--r-- | source/blender/gpu/GPU_batch.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index bb67a90d619..cf69af11aa6 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -196,4 +196,14 @@ void gpu_batch_exit(void); } \ } while (0) +#define GPU_BATCH_DISCARD_ARRAY_SAFE(_batch_array, _len) do { \ + if (_batch_array != NULL) { \ + BLI_assert(_len > 0); \ + for (int _i = 0; _i < _len; _i++) { \ + GPU_BATCH_DISCARD_SAFE(_batch_array[_i]); \ + } \ + MEM_freeN(_batch_array); \ + } \ +} while (0) + #endif /* __GPU_BATCH_H__ */ |