[Bf-blender-cvs] [fe8800eaaee] lanpr-under-gp: LineArt: Memory debug info.

YimingWu noreply at git.blender.org
Wed Oct 14 16:42:38 CEST 2020


Commit: fe8800eaaee97d9fe31bfdae1554061b8d2786ff
Author: YimingWu
Date:   Wed Oct 14 22:42:21 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBfe8800eaaee97d9fe31bfdae1554061b8d2786ff

LineArt: Memory debug info.

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

M	source/blender/editors/lineart/lineart_cpu.c
M	source/blender/editors/lineart/lineart_intern.h
M	source/blender/editors/lineart/lineart_util.c

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

diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index 9800ff6231e..27fa7dd9303 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -3919,6 +3919,9 @@ int ED_lineart_compute_feature_lines_internal(Depsgraph *depsgraph, const int sh
 
 #undef LRT_PROGRESS
 #undef LRT_CANCEL_STAGE
+  if(G.debug_value == 4000){
+    lineart_count_and_print_render_buffer_memory(rb);
+  }
 
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/lineart/lineart_intern.h b/source/blender/editors/lineart/lineart_intern.h
index 443f6606fc4..dcc4eba2f11 100644
--- a/source/blender/editors/lineart/lineart_intern.h
+++ b/source/blender/editors/lineart/lineart_intern.h
@@ -70,4 +70,7 @@ void lineart_matrix_perspective_44d(
 
 int lineart_count_intersection_segment_count(struct LineartRenderBuffer *rb);
 
+
+void lineart_count_and_print_render_buffer_memory(LineartRenderBuffer* rb);
+
 #endif
diff --git a/source/blender/editors/lineart/lineart_util.c b/source/blender/editors/lineart/lineart_util.c
index 5dd929b9c8c..d3ae4c771fa 100644
--- a/source/blender/editors/lineart/lineart_util.c
+++ b/source/blender/editors/lineart/lineart_util.c
@@ -182,3 +182,37 @@ void lineart_matrix_ortho_44d(double (*mProjection)[4],
   mProjection[3][2] = -((zMax + zMin) / (zMax - zMin));
   mProjection[3][3] = 1.0f;
 }
+
+void lineart_count_and_print_render_buffer_memory(LineartRenderBuffer* rb){
+  int i=0;
+  size_t total = 0;
+  size_t sum_this = 0;
+  size_t count_this = 0;
+
+  LISTBASE_FOREACH(LineartStaticMemPoolNode *, smpn, &rb->render_data_pool.pools){
+    count_this++;
+    sum_this+=LRT_MEMORY_POOL_64MB;
+  }
+  printf("LANPR Memory allocated %lu Standalone nodes, total %lu Bytes.\n",count_this,sum_this);
+  total += sum_this;
+  sum_this = 0;
+  count_this = 0;
+
+  LISTBASE_FOREACH(LineartRenderElementLinkNode *, reln, &rb->line_buffer_pointers){
+    count_this++;
+    sum_this+=reln->element_count*sizeof(LineartRenderLine);
+  }
+  printf("             allocated %lu edge blocks, total %lu Bytes.\n",count_this,sum_this);
+  total += sum_this;
+  sum_this = 0;
+  count_this = 0;
+
+  LISTBASE_FOREACH(LineartRenderElementLinkNode *, reln, &rb->triangle_buffer_pointers){
+    count_this++;
+    sum_this+=reln->element_count*rb->triangle_size;
+  }
+  printf("             allocated %lu triangle blocks, total %lu Bytes.\n",count_this,sum_this);
+  total += sum_this;
+  sum_this = 0;
+  count_this = 0;
+}



More information about the Bf-blender-cvs mailing list