Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2021-06-23 16:26:10 +0300
committerYimingWu <xp8110@outlook.com>2021-06-23 16:26:10 +0300
commit87dae08dd3f2a80dd208576b130cabaca21c9912 (patch)
tree9f3ae751c0988f5d37dea9fc26a324c38089156b
parent6521f0cbc677a965257adfa89ec11168f1703844 (diff)
LineAer: benchmark
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h2
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index da9d628dbda..18bd524ed2b 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -347,6 +347,8 @@ typedef struct LineartRenderBuffer {
struct Collection *_source_collection;
struct Object *_source_object;
+ int debug_triangle_isec_test_count;
+
} LineartRenderBuffer;
typedef struct LineartCache {
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index fe3a202e8ed..9a08a093f37 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -65,7 +65,7 @@
#include "lineart_intern.h"
-#define LINEART_WITH_BVH
+//#define LINEART_WITH_BVH
#define LINEART_WITH_BVH_THREAD
#define LINEART_BVH_OWN_ISEC
@@ -2977,6 +2977,8 @@ static void lineart_triangle_intersect_in_bounding_area(LineartRenderBuffer *rb,
continue;
}
+ rb->debug_triangle_isec_test_count++;
+
/* If we do need to compute intersection, then finally do it. */
lineart_triangle_intersect(rb, tri, testing_triangle);
}
@@ -4056,6 +4058,7 @@ typedef struct LineartIsecThread {
LineartIsecSingle *array;
int current;
int max;
+ int count_test;
} LineartIsecThread;
typedef struct LineartIsecData {
LineartRenderBuffer *rb;
@@ -4131,6 +4134,8 @@ static bool lineart_bvh_isec_callback(void *userdata, int index_a, int index_b,
return false;
}
+ d->threads[thread].count_test++;
+
#ifdef LINEART_BVH_OWN_ISEC
float e1[3], e2[3];
@@ -4227,6 +4232,14 @@ static void lineart_do_intersections(LineartRenderBuffer *rb)
BVHTreeOverlap *overlap = BLI_bvhtree_overlap(
rb->bvh_main, rb->bvh_main, &overlap_tot, lineart_bvh_isec_callback, &d);
+ if (G.debug_value == 4000) {
+ int total_test_count = 0;
+ for (int i = 0; i < rb->thread_count; i++) {
+ total_test_count += d.threads[i].count_test;
+ }
+ printf("BVH has done %d pairs.\n", total_test_count);
+ }
+
lineart_create_edges_from_isec_data(&d);
lineart_destroy_isec_thread(&d);
#else
@@ -4611,6 +4624,10 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
#ifdef LINEART_WITH_BVH
lineart_do_intersections(rb);
+#else
+ if (G.debug_value == 4000) {
+ printf("Legacy triangle isec pairs: %d\n", rb->debug_triangle_isec_test_count);
+ }
#endif
/* Link lines to acceleration structure, this can only be done after perspective division, if