1
1

Compare commits

...

16 Commits

Author SHA1 Message Date
a13126209e Lineart: compiler flags. 2021-06-01 21:29:36 +08:00
d13040a268 Lineart: working loader 2021-06-01 21:16:58 +08:00
b7f684e2fc Merge remote-tracking branch 'origin/master' into lineart-fn-thread-loading 2021-06-01 19:55:01 +08:00
a9fe5cb859 Lineart: loading 2021-05-31 20:52:01 +08:00
c15fa13ea0 Merge remote-tracking branch 'origin/master' into lineart-fn-thread-loading 2021-05-28 19:55:49 +08:00
4c68db8b82 Merge remote-tracking branch 'origin/master' into lineart-fn-thread-loading 2021-05-27 19:24:01 +08:00
fc44a658e6 Cleanup: Line art variable naming.
Change `reln` to `eln`.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11411
2021-05-27 19:18:27 +08:00
fc7e36ac60 LineArt: Cleaning up edge list names. 2021-05-27 19:02:01 +08:00
965fabae99 Cleanup: Line art naming changes.
Make variable naming consistent with struct names.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11382
2021-05-27 18:57:15 +08:00
f5d6d3bea5 LineArt: Spreading load for multithread loading of geometry. 2021-05-24 13:51:01 +08:00
e2c8be0b3f LineArt: Fix memory leaking issue in threaded loading. 2021-05-24 13:51:01 +08:00
22cd17360e LineArt: Properly working threaded geometry loading. 2021-05-24 13:51:01 +08:00
258e2b8985 LineArt: Multithread object iterator problem staging. 2021-05-24 13:51:01 +08:00
f37e62c1ea LineArt: Fix threading data assignment. 2021-05-24 13:51:01 +08:00
9bf87bb96e LineArt: Fix slight issues for threading object loading (DG still have problems) 2021-05-24 13:51:01 +08:00
209de896f1 LineArt: Multithread object loading. 2021-05-24 13:51:01 +08:00
5 changed files with 847 additions and 242 deletions

View File

@@ -23,6 +23,7 @@
#pragma once
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h" /* Needed here for inline functions. */
#include "BLI_threads.h"
@@ -226,6 +227,7 @@ typedef struct LineartRenderBuffer {
int tile_count_x, tile_count_y;
double width_per_tile, height_per_tile;
double view_projection[4][4];
double view[4][4];
struct LineartBoundingArea *initial_bounding_areas;
unsigned int bounding_area_count;
@@ -310,7 +312,7 @@ typedef struct LineartRenderBuffer {
#define DBL_TRIANGLE_LIM 1e-8
#define DBL_EDGE_LIM 1e-9
#define LRT_MEMORY_POOL_64MB (1 << 26)
#define LRT_MEMORY_POOL_1MB (1 << 20)
typedef enum eLineartTriangleFlags {
LRT_CULL_DONT_CARE = 0,
@@ -343,6 +345,40 @@ typedef struct LineartRenderTaskInfo {
} LineartRenderTaskInfo;
struct BMesh;
typedef struct LineartObjectInfo {
struct LineartObjectInfo *next;
struct Object *original_ob;
struct Mesh *me;
struct BMesh *original_bm;
double new_mvp[4][4];
double new_mv[4][4];
double normal[4][4];
LineartElementLinkNode *v_reln;
int override_usage;
int global_i_offset;
/* Threads will add lines inside here, when all threads are done, we combine those into the ones
* in LineartRenderBuffer. */
ListBase contour;
ListBase intersection;
ListBase crease;
ListBase material;
ListBase edge_mark;
ListBase floating;
} LineartObjectInfo;
typedef struct LineartObjectLoadTaskInfo {
struct LineartRenderBuffer *rb;
struct Depsgraph *dg;
/* LinkNode styled list */
LineartObjectInfo *pending;
/* Used to spread the load across several threads. This can not overflow. */
long unsigned int total_faces;
} LineartObjectLoadTaskInfo;
/**
* Bounding area diagram:
* \code{.txt}

View File

@@ -77,6 +77,7 @@ static LineartEdgeChain *lineart_chain_create(LineartRenderBuffer *rb)
ec = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartEdgeChain));
BLI_addtail(&rb->chains, ec);
// printf("chain%d\n", ec);
return ec;
}

File diff suppressed because it is too large Load Diff

View File

@@ -43,6 +43,13 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
struct LineartStaticMemPool *smp,
void *data,
int size);
void *lineart_list_append_pointer_pool_thread(ListBase *h,
struct LineartStaticMemPool *smp,
void *data);
void *lineart_list_append_pointer_pool_sized_thread(ListBase *h,
LineartStaticMemPool *smp,
void *data,
int size);
void *list_push_pointer_static(ListBase *h, struct LineartStaticMemPool *smp, void *p);
void *list_push_pointer_static_sized(ListBase *h,
struct LineartStaticMemPool *smp,

View File

@@ -62,6 +62,31 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
BLI_addtail(h, lip);
return lip;
}
void *lineart_list_append_pointer_pool_thread(ListBase *h, LineartStaticMemPool *smp, void *data)
{
LinkData *lip;
if (h == NULL) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, sizeof(LinkData));
lip->data = data;
BLI_addtail(h, lip);
return lip;
}
void *lineart_list_append_pointer_pool_sized_thread(ListBase *h,
LineartStaticMemPool *smp,
void *data,
int size)
{
LinkData *lip;
if (h == NULL) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, size);
lip->data = data;
BLI_addtail(h, lip);
return lip;
}
void *lineart_list_pop_pointer_no_free(ListBase *h)
{
@@ -82,10 +107,10 @@ void lineart_list_remove_pointer_item_no_free(ListBase *h, LinkData *lip)
LineartStaticMemPoolNode *lineart_mem_new_static_pool(LineartStaticMemPool *smp, size_t size)
{
size_t set_size = size;
if (set_size < LRT_MEMORY_POOL_64MB) {
set_size = LRT_MEMORY_POOL_64MB; /* Prevent too many small allocations. */
if (set_size < LRT_MEMORY_POOL_1MB) {
set_size = LRT_MEMORY_POOL_1MB; /* Prevent too many small allocations. */
}
size_t total_size = size + sizeof(LineartStaticMemPoolNode);
size_t total_size = set_size + sizeof(LineartStaticMemPoolNode);
LineartStaticMemPoolNode *smpn = MEM_callocN(total_size, "mempool");
smpn->size = total_size;
smpn->used_byte = sizeof(LineartStaticMemPoolNode);
@@ -211,7 +236,7 @@ void lineart_count_and_print_render_buffer_memory(LineartRenderBuffer *rb)
LISTBASE_FOREACH (LineartStaticMemPoolNode *, smpn, &rb->render_data_pool.pools) {
count_this++;
sum_this += LRT_MEMORY_POOL_64MB;
sum_this += LRT_MEMORY_POOL_1MB;
}
printf("LANPR Memory allocated %zu Standalone nodes, total %zu Bytes.\n", count_this, sum_this);
total += sum_this;