[Bf-blender-cvs] [fe80d8ec3c4] blender2.8: DRW: Do not recreate the common uniform buffer every frame.

Clément Foucault noreply at git.blender.org
Tue Feb 27 15:51:03 CET 2018


Commit: fe80d8ec3c459500258c33d2058558658f1df4f2
Author: Clément Foucault
Date:   Mon Feb 26 21:12:19 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBfe80d8ec3c459500258c33d2058558658f1df4f2

DRW: Do not recreate the common uniform buffer every frame.

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

M	source/blender/draw/intern/draw_common.c

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

diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 62166092638..681a6a8dabe 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -122,12 +122,12 @@ void DRW_globals_update(void)
 	ts.sizeEdge = 1.0f / 2.0f; /* TODO Theme */
 	ts.sizeEdgeFix = 0.5f + 2.0f * (2.0f * (MAX2(ts.sizeVertex, ts.sizeEdge)) * (float)M_SQRT1_2);
 
-	/* TODO Waiting for notifiers to invalidate cache */
-	if (globals_ubo) {
-		DRW_uniformbuffer_free(globals_ubo);
+
+	if (globals_ubo == NULL) {
+		globals_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), &ts);
 	}
 
-	globals_ubo = DRW_uniformbuffer_create(sizeof(GlobalsUboStorage), &ts);
+	DRW_uniformbuffer_update(globals_ubo, &ts);
 
 	ColorBand ramp = {0};
 	float *colors;



More information about the Bf-blender-cvs mailing list