Compare commits
16 Commits
node-add-a
...
lineart-fn
Author | SHA1 | Date | |
---|---|---|---|
a13126209e | |||
d13040a268 | |||
b7f684e2fc | |||
a9fe5cb859 | |||
c15fa13ea0 | |||
4c68db8b82 | |||
fc44a658e6 | |||
fc7e36ac60 | |||
965fabae99 | |||
f5d6d3bea5 | |||
e2c8be0b3f | |||
22cd17360e | |||
258e2b8985 | |||
f37e62c1ea | |||
9bf87bb96e | |||
209de896f1 |
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "BLI_linklist.h"
|
||||||
#include "BLI_listbase.h"
|
#include "BLI_listbase.h"
|
||||||
#include "BLI_math.h" /* Needed here for inline functions. */
|
#include "BLI_math.h" /* Needed here for inline functions. */
|
||||||
#include "BLI_threads.h"
|
#include "BLI_threads.h"
|
||||||
@@ -226,6 +227,7 @@ typedef struct LineartRenderBuffer {
|
|||||||
int tile_count_x, tile_count_y;
|
int tile_count_x, tile_count_y;
|
||||||
double width_per_tile, height_per_tile;
|
double width_per_tile, height_per_tile;
|
||||||
double view_projection[4][4];
|
double view_projection[4][4];
|
||||||
|
double view[4][4];
|
||||||
|
|
||||||
struct LineartBoundingArea *initial_bounding_areas;
|
struct LineartBoundingArea *initial_bounding_areas;
|
||||||
unsigned int bounding_area_count;
|
unsigned int bounding_area_count;
|
||||||
@@ -310,7 +312,7 @@ typedef struct LineartRenderBuffer {
|
|||||||
#define DBL_TRIANGLE_LIM 1e-8
|
#define DBL_TRIANGLE_LIM 1e-8
|
||||||
#define DBL_EDGE_LIM 1e-9
|
#define DBL_EDGE_LIM 1e-9
|
||||||
|
|
||||||
#define LRT_MEMORY_POOL_64MB (1 << 26)
|
#define LRT_MEMORY_POOL_1MB (1 << 20)
|
||||||
|
|
||||||
typedef enum eLineartTriangleFlags {
|
typedef enum eLineartTriangleFlags {
|
||||||
LRT_CULL_DONT_CARE = 0,
|
LRT_CULL_DONT_CARE = 0,
|
||||||
@@ -343,6 +345,40 @@ typedef struct LineartRenderTaskInfo {
|
|||||||
|
|
||||||
} 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:
|
* Bounding area diagram:
|
||||||
* \code{.txt}
|
* \code{.txt}
|
||||||
|
@@ -77,6 +77,7 @@ static LineartEdgeChain *lineart_chain_create(LineartRenderBuffer *rb)
|
|||||||
ec = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartEdgeChain));
|
ec = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartEdgeChain));
|
||||||
|
|
||||||
BLI_addtail(&rb->chains, ec);
|
BLI_addtail(&rb->chains, ec);
|
||||||
|
// printf("chain%d\n", ec);
|
||||||
|
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,13 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
|
|||||||
struct LineartStaticMemPool *smp,
|
struct LineartStaticMemPool *smp,
|
||||||
void *data,
|
void *data,
|
||||||
int size);
|
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(ListBase *h, struct LineartStaticMemPool *smp, void *p);
|
||||||
void *list_push_pointer_static_sized(ListBase *h,
|
void *list_push_pointer_static_sized(ListBase *h,
|
||||||
struct LineartStaticMemPool *smp,
|
struct LineartStaticMemPool *smp,
|
||||||
|
@@ -62,6 +62,31 @@ void *lineart_list_append_pointer_pool_sized(ListBase *h,
|
|||||||
BLI_addtail(h, lip);
|
BLI_addtail(h, lip);
|
||||||
return 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)
|
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)
|
LineartStaticMemPoolNode *lineart_mem_new_static_pool(LineartStaticMemPool *smp, size_t size)
|
||||||
{
|
{
|
||||||
size_t set_size = size;
|
size_t set_size = size;
|
||||||
if (set_size < LRT_MEMORY_POOL_64MB) {
|
if (set_size < LRT_MEMORY_POOL_1MB) {
|
||||||
set_size = LRT_MEMORY_POOL_64MB; /* Prevent too many small allocations. */
|
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");
|
LineartStaticMemPoolNode *smpn = MEM_callocN(total_size, "mempool");
|
||||||
smpn->size = total_size;
|
smpn->size = total_size;
|
||||||
smpn->used_byte = sizeof(LineartStaticMemPoolNode);
|
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) {
|
LISTBASE_FOREACH (LineartStaticMemPoolNode *, smpn, &rb->render_data_pool.pools) {
|
||||||
count_this++;
|
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);
|
printf("LANPR Memory allocated %zu Standalone nodes, total %zu Bytes.\n", count_this, sum_this);
|
||||||
total += sum_this;
|
total += sum_this;
|
||||||
|
Reference in New Issue
Block a user