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:
authorCampbell Barton <ideasman42@gmail.com>2018-09-11 06:17:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-11 06:21:47 +0300
commit58a8277098b5c8cf43985d7955ad5e5c6f7894ae (patch)
treedeae71172906a3df309c2aa512d938bfe0f04bd4 /source/blender/gpu/intern/gpu_batch_presets.c
parent0b597bf7b96ac7c613f80c11165f869e036d55ef (diff)
GPU: utility function to unregister presets
Diffstat (limited to 'source/blender/gpu/intern/gpu_batch_presets.c')
-rw-r--r--source/blender/gpu/intern/gpu_batch_presets.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c
index 83287c57441..126897ac8bf 100644
--- a/source/blender/gpu/intern/gpu_batch_presets.c
+++ b/source/blender/gpu/intern/gpu_batch_presets.c
@@ -221,12 +221,23 @@ void gpu_batch_presets_register(GPUBatch *preset_batch)
BLI_addtail(&presets_list, BLI_genericNodeN(preset_batch));
}
+bool gpu_batch_presets_unregister(GPUBatch *preset_batch)
+{
+ for (LinkData *link = presets_list.last; link; link = link->prev) {
+ if (preset_batch == link->data) {
+ BLI_remlink(&presets_list, link);
+ MEM_freeN(link);
+ return true;
+ }
+ }
+ return false;
+}
+
void gpu_batch_presets_reset(void)
{
/* Reset vao caches for these every time we switch opengl context.
* This way they will draw correctly for each window. */
- LinkData *link = presets_list.first;
- for (link = presets_list.first; link; link = link->next) {
+ for (LinkData *link = presets_list.first; link; link = link->next) {
GPUBatch *preset = link->data;
GPU_batch_vao_cache_clear(preset);
}