Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-08-30 23:47:36 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-08-30 23:49:05 +0300
commitf436e0acab6cb510a74fe9e04b7dfb1c2ac142b5 (patch)
treeedae4e385c9018ab7f4586e1edededcd1841d719 /source/blender/gpu/GPU_batch.h
parent7527f2317a01b911638c0db5df2661241c31c7b0 (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.h10
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__ */