diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-09 09:38:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-09 09:42:18 +0400 |
commit | a068dda5f381c59c96ff1fc0fdc60cc0296c7c1e (patch) | |
tree | 0d13f977d67983207626358fe2a48899c48d3947 /source | |
parent | 9de24c82bab8fc6f1b8810979ac492787d32a964 (diff) |
Code cleanup: ifdef unused linklist for GPU drawobject's
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 33 |
2 files changed, 35 insertions, 2 deletions
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 1d27824483f..a1ab1451647 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -94,9 +94,13 @@ typedef struct GPUDrawObject { /* for each original vertex, the list of related points */ struct GPUVertPointLink *vert_points; + + /* see: USE_GPU_POINT_LINK define */ +#if 0 /* storage for the vert_points lists */ struct GPUVertPointLink *vert_points_mem; int vert_points_usage; +#endif int colType; diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 1eddd90a902..82c14695fec 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -377,14 +377,22 @@ void GPU_buffer_free(GPUBuffer *buffer) BLI_mutex_unlock(&buffer_mutex); } +/* currently unused */ +// #define USE_GPU_POINT_LINK + typedef struct GPUVertPointLink { +#ifdef USE_GPU_POINT_LINK struct GPUVertPointLink *next; +#endif /* -1 means uninitialized */ int point_index; } GPUVertPointLink; + /* add a new point to the list of points related to a particular * vertex */ +#ifdef USE_GPU_POINT_LINK + static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, int point_index) { GPUVertPointLink *lnk; @@ -404,6 +412,19 @@ static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, in lnk->point_index = point_index; } +#else + +static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, int point_index) +{ + GPUVertPointLink *lnk; + lnk = &gdo->vert_points[vert_index]; + if (lnk->point_index == -1) { + lnk->point_index = point_index; + } +} + +#endif /* USE_GPU_POINT_LINK */ + /* update the vert_points and triangle_to_mface fields with a new * triangle */ static void gpu_drawobject_add_triangle(GPUDrawObject *gdo, @@ -427,11 +448,13 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to mat_orig_to_new = MEM_callocN(sizeof(*mat_orig_to_new) * totmat, "GPUDrawObject.mat_orig_to_new"); /* allocate the array and space for links */ - gdo->vert_points = MEM_callocN(sizeof(GPUVertPointLink) * gdo->totvert, + gdo->vert_points = MEM_mallocN(sizeof(GPUVertPointLink) * gdo->totvert, "GPUDrawObject.vert_points"); +#ifdef USE_GPU_POINT_LINK gdo->vert_points_mem = MEM_callocN(sizeof(GPUVertPointLink) * gdo->tot_triangle_point, "GPUDrawObject.vert_points_mem"); gdo->vert_points_usage = 0; +#endif /* build a map from the original material indices to the new * GPUBufferMaterial indices */ @@ -439,8 +462,12 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to mat_orig_to_new[gdo->materials[i].mat_nr] = i; /* -1 indicates the link is not yet used */ - for (i = 0; i < gdo->totvert; i++) + for (i = 0; i < gdo->totvert; i++) { +#ifdef USE_GPU_POINT_LINK + gdo->vert_points[i].link = NULL; +#endif gdo->vert_points[i].point_index = -1; + } for (i = 0; i < totface; i++, f++) { mat = &gdo->materials[mat_orig_to_new[f->mat_nr]]; @@ -540,7 +567,9 @@ void GPU_drawobject_free(DerivedMesh *dm) MEM_freeN(gdo->materials); MEM_freeN(gdo->triangle_to_mface); MEM_freeN(gdo->vert_points); +#ifdef USE_GPU_POINT_LINK MEM_freeN(gdo->vert_points_mem); +#endif GPU_buffer_free(gdo->points); GPU_buffer_free(gdo->normals); GPU_buffer_free(gdo->uv); |