[Bf-blender-cvs] [b2dc54ffe58] blender2.8: Stupid mistake in material access optimization

Campbell Barton noreply at git.blender.org
Tue May 23 13:48:46 CEST 2017


Commit: b2dc54ffe589a47999bf0c9d415ba8143bd96a36
Author: Campbell Barton
Date:   Tue May 23 21:52:18 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBb2dc54ffe589a47999bf0c9d415ba8143bd96a36

Stupid mistake in material access optimization

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

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

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

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index ae968ca6944..6c58040d49a 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2645,9 +2645,10 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
 			BM_ITER_MESH(f, &fiter, bm, BM_FACES_OF_MESH) {
 				if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
 					const short ma_id = f->mat_nr < mat_len ? f->mat_nr : 0;
-
-					add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
-					nidx += 3;
+					for (int j = 2; j < f->len; j++) {
+						add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+						nidx += 3;
+					}
 				}
 			}
 		}
@@ -2655,9 +2656,10 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
 			for (uint i = 0; i < poly_len; i++) {
 				const MPoly *mp = &rdata->mpoly[i]; ;
 				const short ma_id = mp->mat_nr < mat_len ? mp->mat_nr : 0;
-
-				add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
-				nidx += 3;
+				for (int j = 2; j < mp->totloop; j++) {
+					add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+					nidx += 3;
+				}
 			}
 		}




More information about the Bf-blender-cvs mailing list