[Bf-blender-cvs] [ed72eedd073] blender2.8: Workbench: Fixed SegFault

Jeroen Bakker noreply at git.blender.org
Wed Apr 18 10:45:35 CEST 2018


Commit: ed72eedd0730f09c0a90b8888bc8f5a872396744
Author: Jeroen Bakker
Date:   Wed Apr 18 10:43:03 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBed72eedd0730f09c0a90b8888bc8f5a872396744

Workbench: Fixed SegFault

In more complex models the object color uniform data is freed before rendered.
We should copy it to local data. but for now we redirected it to a
constant.

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

M	source/blender/draw/engines/workbench/solid_flat_mode.c
M	source/blender/draw/engines/workbench/solid_studio_mode.c

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

diff --git a/source/blender/draw/engines/workbench/solid_flat_mode.c b/source/blender/draw/engines/workbench/solid_flat_mode.c
index cb3ae755609..d601d434292 100644
--- a/source/blender/draw/engines/workbench/solid_flat_mode.c
+++ b/source/blender/draw/engines/workbench/solid_flat_mode.c
@@ -44,6 +44,7 @@ static struct {
 	struct GPUShader *solid_sh;
 
 } e_data = {NULL};
+const float SOLID_FLAT_DEFAULT_COLOR[3] = {1.0, 1.0, 1.0};
 
 
 /* Functions */
@@ -94,7 +95,7 @@ static void workbench_solid_flat_cache_populate(void *vedata, Object *ob)
 	WORKBENCH_StorageList *stl = data->stl;
 
 	IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_WORKBENCH);
-	const float* color = BKE_collection_engine_property_value_get_float_array(props, "object_color");
+	// const float* color = BKE_collection_engine_property_value_get_float_array(props, "object_color");
 
 	if (!DRW_object_is_renderable(ob))
 		return;
@@ -107,7 +108,7 @@ static void workbench_solid_flat_cache_populate(void *vedata, Object *ob)
 
 		/* Solid */
 		grp = DRW_shgroup_create(e_data.solid_sh, psl->solid_pass);
-		DRW_shgroup_uniform_vec3(grp, "color", color, 1);
+		DRW_shgroup_uniform_vec3(grp, "color", SOLID_FLAT_DEFAULT_COLOR, 1);
 		DRW_shgroup_call_add(grp, geom, ob->obmat);
 	}
 }
diff --git a/source/blender/draw/engines/workbench/solid_studio_mode.c b/source/blender/draw/engines/workbench/solid_studio_mode.c
index 386b5b0c690..210f5b41661 100644
--- a/source/blender/draw/engines/workbench/solid_studio_mode.c
+++ b/source/blender/draw/engines/workbench/solid_studio_mode.c
@@ -44,6 +44,7 @@ static struct {
 	struct GPUShader *solid_sh;
 
 } e_data = {NULL};
+const float SOLID_STUDIO_DEFAULT_COLOR[3] = {1.0, 1.0, 1.0};
 
 
 /* Functions */
@@ -107,7 +108,7 @@ static void workbench_solid_studio_cache_populate(void *vedata, Object *ob)
 
 		/* Solid */
 		grp = DRW_shgroup_create(e_data.solid_sh, psl->solid_pass);
-		DRW_shgroup_uniform_vec3(grp, "color", color, 1);
+		DRW_shgroup_uniform_vec3(grp, "color", SOLID_STUDIO_DEFAULT_COLOR, 1);
 		DRW_shgroup_call_add(grp, geom, ob->obmat);
 	}
 }



More information about the Bf-blender-cvs mailing list