[Bf-blender-cvs] [228ba8475a1] blender2.8: DRW: Add cache reset.

Clément Foucault noreply at git.blender.org
Mon Jun 11 13:56:42 CEST 2018


Commit: 228ba8475a17b2d0d87e5ef1f6b026027c1406cf
Author: Clément Foucault
Date:   Mon Jun 11 11:36:09 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB228ba8475a17b2d0d87e5ef1f6b026027c1406cf

DRW: Add cache reset.

This is a temporary solution to the use of the shared cache.

Ideally this cache should be per gl drawing context.

===================================================================

M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache.h

===================================================================

diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 36a98d6cec3..a8d2c2a3642 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -112,6 +112,17 @@ void DRW_shape_cache_free(void)
 	}
 }
 
+void DRW_shape_cache_reset(void)
+{
+	uint i = sizeof(SHC) / sizeof(Gwn_Batch *);
+	Gwn_Batch **batch = (Gwn_Batch **)&SHC;
+	while (i--) {
+		if (*batch) {
+			gwn_batch_vao_cache_clear(*batch);
+		}
+		batch++;
+	}
+}
 
 /* -------------------------------------------------------------------- */
 
diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h
index 871da9203ca..e7ab847d42e 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -33,6 +33,7 @@ struct Object;
 struct PTCacheEdit;
 
 void DRW_shape_cache_free(void);
+void DRW_shape_cache_reset(void);
 
 /* 3D cursor */
 struct Gwn_Batch *DRW_cache_cursor_get(bool crosshair_lines);



More information about the Bf-blender-cvs mailing list