[Bf-blender-cvs] [d09822c8763] tmp_hair_curves: Fix a few minor crashes from unfinished hair shader code.

Lukas Tönne noreply at git.blender.org
Mon Jul 2 09:23:50 CEST 2018


Commit: d09822c8763b11e17a65792cb458003e0dd61388
Author: Lukas Tönne
Date:   Mon Jul 2 08:19:58 2018 +0100
Branches: tmp_hair_curves
https://developer.blender.org/rBd09822c8763b11e17a65792cb458003e0dd61388

Fix a few minor crashes from unfinished hair shader code.

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

M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/intern/draw_cache_impl_hair.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index da57225156b..02cbbc2f036 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1514,10 +1514,16 @@ static void material_hair(
 	}
 	
 	{
-		/*DRWShadingGroup *shgrp =*/ DRW_shgroup_hair_create(ob, hsys, scalp, draw_set, psl->depth_pass, e_data.default_hair_prepass_sh);
+		/*DRWShadingGroup *shgrp =*/ DRW_shgroup_hair_create(
+		            ob, hsys, scalp, draw_set,
+		            psl->depth_pass,
+		            e_data.default_hair_prepass_sh);
 	}
 	{
-		DRWShadingGroup *shgrp = DRW_shgroup_hair_create(ob, hsys, scalp, draw_set, psl->depth_pass_clip, e_data.default_hair_prepass_clip_sh);
+		DRWShadingGroup *shgrp = DRW_shgroup_hair_create(
+		                             ob, hsys, scalp, draw_set,
+		                             psl->depth_pass_clip,
+		                             e_data.default_hair_prepass_clip_sh);
 		DRW_shgroup_uniform_block(shgrp, "clip_block", sldata->clip_ubo);
 	}
 	
diff --git a/source/blender/draw/intern/draw_cache_impl_hair.c b/source/blender/draw/intern/draw_cache_impl_hair.c
index b2ba6113048..3712e256199 100644
--- a/source/blender/draw/intern/draw_cache_impl_hair.c
+++ b/source/blender/draw/intern/draw_cache_impl_hair.c
@@ -125,7 +125,9 @@ void DRW_hair_batch_cache_dirty(HairSystem *hsys, int mode)
 static void hair_batch_cache_clear(HairSystem *hsys)
 {
 	HairBatchCache *cache = hsys->draw_batch_cache;
-	particle_batch_cache_clear_hair(&cache->hair);
+	if (cache) {
+		particle_batch_cache_clear_hair(&cache->hair);
+	}
 }
 
 void DRW_hair_batch_cache_free(HairSystem *hsys)
@@ -213,10 +215,10 @@ static void hair_batch_cache_ensure_procedural_strand_data(
         const HairExportCache *hair_export,
         ParticleHairCache *cache)
 {
-#if 0 // TODO
 	int active_uv = 0;
 	int active_col = 0;
 
+#if 0 // TODO
 	ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
 
 	if (psmd != NULL && psmd->mesh_final != NULL) {
@@ -229,6 +231,7 @@ static void hair_batch_cache_ensure_procedural_strand_data(
 			active_col = CustomData_get_active_layer(&psmd->mesh_final->ldata, CD_MLOOPCOL);
 		}
 	}
+#endif
 
 	Gwn_VertBufRaw data_step;
 	Gwn_VertBufRaw uv_step[MAX_MTFACE];
@@ -256,6 +259,7 @@ static void hair_batch_cache_ensure_procedural_strand_data(
 	GWN_vertbuf_data_alloc(cache->proc_strand_buf, cache->strands_count);
 	GWN_vertbuf_attr_get_raw_data(cache->proc_strand_buf, data_id, &data_step);
 
+#if 0 // TODO
 	/* UV layers */
 	for (int i = 0; i < cache->num_uv_layers; i++) {
 		cache->proc_uv_buf[i] = GWN_vertbuf_create_with_format(&format_uv);
@@ -351,8 +355,6 @@ static void hair_batch_cache_ensure_procedural_strand_data(
 		}
 		MEM_freeN(parent_mcol);
 	}
-#else
-	UNUSED_VARS(hair_export);
 #endif
 
 	/* Create vbo immediatly to bind to texture buffer. */
@@ -491,3 +493,17 @@ bool hair_ensure_procedural_data(
 
 	return need_ft_update;
 }
+
+Gwn_Batch *DRW_hair_batch_cache_get_fibers(HairSystem *hsys, const HairExportCache *hair_export)
+{
+	// TODO
+	UNUSED_VARS(hsys, hair_export);
+	return NULL;
+}
+
+Gwn_Batch *DRW_hair_batch_cache_get_follicle_points(HairSystem *hsys, const HairExportCache *hair_export)
+{
+	// TODO
+	UNUSED_VARS(hsys, hair_export);
+	return NULL;
+}



More information about the Bf-blender-cvs mailing list