[Bf-blender-cvs] [95547bd7504] blender2.8: Minor cleanup in clay_engine.c

Luca Rood noreply at git.blender.org
Tue May 16 16:44:18 CEST 2017


Commit: 95547bd75042c9228b7a84b25d691ba6308cb18b
Author: Luca Rood
Date:   Tue May 16 16:43:24 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB95547bd75042c9228b7a84b25d691ba6308cb18b

Minor cleanup in clay_engine.c

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

M	source/blender/draw/engines/clay/clay_engine.c

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

diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index c4cca1f537b..8abf85a14cc 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -62,7 +62,7 @@ typedef struct CLAY_UBO_Material {
 	float matcap_rot[2];
 	float pad[2]; /* ensure 16 bytes alignement */
 } CLAY_UBO_Material; /* 48 bytes */
-BLI_STATIC_ASSERT_ALIGN(CLAY_UBO_Material, 16);
+BLI_STATIC_ASSERT_ALIGN(CLAY_UBO_Material, 16)
 
 typedef struct CLAY_HAIR_UBO_Material {
 	float hair_randomness;
@@ -70,7 +70,8 @@ typedef struct CLAY_HAIR_UBO_Material {
 	float matcap_rot[2];
 	float matcap_hsv[3];
 	float pad;
-} CLAY_HAIR_UBO_Material; /* 48 bytes */
+} CLAY_HAIR_UBO_Material; /* 32 bytes */
+BLI_STATIC_ASSERT_ALIGN(CLAY_UBO_Material, 16)
 
 #define MAX_CLAY_MAT 512 /* 512 = 9 bit material id */
 
@@ -154,7 +155,6 @@ static struct {
 
 	/* Just a serie of int from 0 to MAX_CLAY_MAT-1 */
 	int ubo_mat_idxs[MAX_CLAY_MAT];
-	int hair_ubo_mat_idxs[MAX_CLAY_MAT];
 } e_data = {NULL}; /* Engine data */
 
 typedef struct CLAY_PrivateData {
@@ -372,13 +372,6 @@ static void CLAY_engine_init(void *vedata)
 		}
 	}
 
-	if (e_data.hair_ubo_mat_idxs[1] == 0) {
-		/* Just int to have pointers to them */
-		for (int i = 0; i < MAX_CLAY_MAT; ++i) {
-			e_data.hair_ubo_mat_idxs[i] = i;
-		}
-	}
-
 	if (DRW_state_is_fbo()) {
 		const float *viewport_size = DRW_viewport_size_get();
 		DRWFboTexture tex = {&txl->depth_dup, DRW_BUF_DEPTH_24, 0};
@@ -668,7 +661,7 @@ static DRWShadingGroup *CLAY_hair_shgrp_get(Object *ob, CLAY_StorageList *stl, C
 	                              matcap_val, hair_randomness, matcap_icon);
 
 	if (hair_shgrps[hair_id] == NULL) {
-		hair_shgrps[hair_id] = CLAY_hair_shgroup_create(psl->hair_pass, &e_data.hair_ubo_mat_idxs[hair_id]);
+		hair_shgrps[hair_id] = CLAY_hair_shgroup_create(psl->hair_pass, &e_data.ubo_mat_idxs[hair_id]);
 		/* if it's the first shgrp, pass bind the material UBO */
 		if (stl->storage->hair_ubo_current_id == 1) {
 			DRW_shgroup_uniform_block(hair_shgrps[0], "material_block", stl->hair_mat_ubo);




More information about the Bf-blender-cvs mailing list