[Bf-blender-cvs] [e3363451667] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

Yiming Wu noreply at git.blender.org
Thu Jun 2 05:21:25 CEST 2022


Commit: e3363451667299b1cbc85b04bcec3f106e5dc216
Author: Yiming Wu
Date:   Thu Jun 2 11:21:07 2022 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBe3363451667299b1cbc85b04bcec3f106e5dc216

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

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



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

diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index e2329580594,aae439c62a2..b40be609677
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -4425,27 -4150,35 +4429,32 @@@ static void lineart_main_add_triangles(
      t_start = PIL_check_seconds_timer();
    }
  
 -  LISTBASE_FOREACH (LineartElementLinkNode *, eln, &rb->triangle_buffer_pointers) {
 -    tri = eln->pointer;
 -    lim = eln->element_count;
 -    for (i = 0; i < lim; i++) {
 -      if ((tri->flags & LRT_CULL_USED) || (tri->flags & LRT_CULL_DISCARD)) {
 -        tri = (void *)(((uchar *)tri) + rb->triangle_size);
 -        continue;
 -      }
 -      if (lineart_get_triangle_bounding_areas(rb, tri, &y1, &y2, &x1, &x2)) {
 -        for (co = x1; co <= x2; co++) {
 -          for (r = y1; r <= y2; r++) {
 -            lineart_bounding_area_link_triangle(rb,
 -                                                &rb->initial_bounding_areas[r * LRT_BA_ROWS + co],
 -                                                tri,
 -                                                0,
 -                                                1,
 -                                                0,
 -                                                (!(tri->flags & LRT_TRIANGLE_NO_INTERSECTION)));
 -          }
 -        }
 -      } /* Else throw away. */
 -      tri = (void *)(((uchar *)tri) + rb->triangle_size);
 -    }
 +  /* Initialize per-thread data for thread task scheduling information and storing intersection
 +   * results.  */
 +  LineartIsecData d = {0};
 +  lineart_init_isec_thread(&d, rb, rb->thread_count);
 +
 +  TaskPool *tp = BLI_task_pool_create(NULL, TASK_PRIORITY_HIGH);
 +  for (int i = 0; i < rb->thread_count; i++) {
 +    BLI_task_pool_push(tp, (TaskRunFunction)lineart_add_triangles_worker, &d.threads[i], 0, NULL);
 +  }
 +  BLI_task_pool_work_and_wait(tp);
 +  BLI_task_pool_free(tp);
 +
 +  /* Create actual lineart edges from intersection results.  */
 +  lineart_create_edges_from_isec_data(&d);
 +
 +  lineart_destroy_isec_thread(&d);
 +
 +  if (G.debug_value == 4000) {
 +    double t_elapsed = PIL_check_seconds_timer() - t_start;
 +    printf("Line art intersection time: %f\n", t_elapsed);
    }
+ 
+   if (G.debug_value == 4000) {
+     double t_elapsed = PIL_check_seconds_timer() - t_start;
+     printf("Line art intersection time: %f\n", t_elapsed);
+   }
  }
  
  /**
diff --cc source/blender/makesdna/DNA_lineart_types.h
index 3b0f2baa310,df496269644..0198f4bcdc4
--- a/source/blender/makesdna/DNA_lineart_types.h
+++ b/source/blender/makesdna/DNA_lineart_types.h
@@@ -48,10 -47,9 +48,10 @@@ typedef enum eLineartEdgeFlag 
    LRT_EDGE_FLAG_MATERIAL = (1 << 3),
    LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
    LRT_EDGE_FLAG_LOOSE = (1 << 5),
 +  LRT_EDGE_FLAG_LIGHT_CONTOUR = (1 << 6),
    /* LRT_EDGE_FLAG_FOR_FUTURE = (1 << 7), */
-   /* Limited to 8 bits for edge type flag, don't add anymore because BMEdge->head.eflag only has 8
-      bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */
+   /* Limited to 8 bits for edge type flag, don't add anymore because `BMEdge->head.eflag` only has
+    * 8 bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */
    /** Also used as discarded line mark. */
    LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 8),
    LRT_EDGE_FLAG_CLIPPED = (1 << 9),



More information about the Bf-blender-cvs mailing list