Commit: c541f3abef105e7a1f3a35c0a070464472d443d7 Author: Clément Foucault Date: Tue Dec 11 21:25:17 2018 +0100 Branches: blender2.8 https://developer.blender.org/rBc541f3abef105e7a1f3a35c0a070464472d443d7
DRW: Fix redundant texture creation =================================================================== 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 e3fde3d8a5d..35f060bd3ba 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -163,29 +163,28 @@ void DRW_globals_update(void) DRW_uniformbuffer_update(globals_ubo, &ts); - ColorBand ramp = {0}; - float *colors; - int col_size; + if (!globals_ramp) { + ColorBand ramp = {0}; + float *colors; + int col_size; - ramp.tot = 3; - ramp.data[0].a = 1.0f; - ramp.data[0].b = 1.0f; - ramp.data[0].pos = 0.0f; - ramp.data[1].a = 1.0f; - ramp.data[1].g = 1.0f; - ramp.data[1].pos = 0.5f; - ramp.data[2].a = 1.0f; - ramp.data[2].r = 1.0f; - ramp.data[2].pos = 1.0f; + ramp.tot = 3; + ramp.data[0].a = 1.0f; + ramp.data[0].b = 1.0f; + ramp.data[0].pos = 0.0f; + ramp.data[1].a = 1.0f; + ramp.data[1].g = 1.0f; + ramp.data[1].pos = 0.5f; + ramp.data[2].a = 1.0f; + ramp.data[2].r = 1.0f; + ramp.data[2].pos = 1.0f; - BKE_colorband_evaluate_table_rgba(&ramp, &colors, &col_size); + BKE_colorband_evaluate_table_rgba(&ramp, &colors, &col_size); - if (globals_ramp) { - GPU_texture_free(globals_ramp); - } - globals_ramp = GPU_texture_create_1D(col_size, GPU_RGBA8, colors, NULL); + globals_ramp = GPU_texture_create_1D(col_size, GPU_RGBA8, colors, NULL); - MEM_freeN(colors); + MEM_freeN(colors); + } /* Weight Painting color ramp texture */ bool user_weight_ramp = (U.flag & USER_CUSTOM_RANGE) != 0; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs