[Bf-blender-cvs] [5cfe6607d83] soc-2019-npr: Remove obsolete memory pool

Yiming Wu noreply at git.blender.org
Thu May 30 06:36:35 CEST 2019


Commit: 5cfe6607d83abfc017556d3f02cdceeddc8219be
Author: Yiming Wu
Date:   Thu May 30 12:35:16 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB5cfe6607d83abfc017556d3f02cdceeddc8219be

Remove obsolete memory pool

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

M	source/blender/draw/engines/lanpr/lanpr_all.h
M	source/blender/draw/engines/lanpr/lanpr_ops.c
M	source/blender/draw/engines/lanpr/lanpr_util.c
M	source/blender/draw/engines/lanpr/lanpr_util.h

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

diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h b/source/blender/draw/engines/lanpr/lanpr_all.h
index 899082f4740..6bf3f6874dc 100644
--- a/source/blender/draw/engines/lanpr/lanpr_all.h
+++ b/source/blender/draw/engines/lanpr/lanpr_all.h
@@ -1,4 +1,27 @@
-#pragma once
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright 2016, Blender Foundation.
+ */
+
+/** \file
+ * \ingroup DNA
+ */
+
+#ifndef __LANPR_ALL_H__
+#define __LANPR_ALL_H__
 
 #include "lanpr_util.h"
 #include "BLI_mempool.h"
@@ -307,7 +330,7 @@ typedef struct LANPR_RenderBuffer {
   struct GPUBatch *DPIXIntersectionBatch;
 
   /* use own-implemented one */
-  nStaticMemoryPool render_data_pool;
+  LANPR_StaticMemPool render_data_pool;
 
   Material *material_pointers[2048];
 
@@ -820,3 +843,6 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer *dfb, int is_render)
 void lanpr_set_render_flag();
 void lanpr_clear_render_flag();
 int lanpr_during_render();
+
+
+#endif
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 2e0a2819727..fd3d9f1af23 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -123,7 +123,7 @@ void lanpr_connect_new_bounding_areas(LANPR_RenderBuffer *rb, LANPR_BoundingArea
 {
   LANPR_BoundingArea *ba = Root->child, *tba;
   LinkData *lip, *lip2, *next_lip;
-  nStaticMemoryPool *mph = &rb->render_data_pool;
+  LANPR_StaticMemPool *mph = &rb->render_data_pool;
 
   list_append_pointer_static_pool(mph, &ba[1].rp, &ba[0]);
   list_append_pointer_static_pool(mph, &ba[0].lp, &ba[1]);
@@ -3316,7 +3316,7 @@ void lanpr_destroy_render_data(LANPR_RenderBuffer *rb)
   BLI_spin_end(&rb->cs_data);
   BLI_spin_end(&rb->cs_info);
   BLI_spin_end(&rb->cs_management);
-  BLI_spin_end(&rb->render_data_pool.csMem);
+  BLI_spin_end(&rb->render_data_pool.cs_mem);
 
   mem_static_destroy(&rb->render_data_pool);
 }
@@ -3341,7 +3341,7 @@ LANPR_RenderBuffer *lanpr_create_render_buffer(SceneLANPR *lanpr)
   BLI_spin_init(&rb->cs_data);
   BLI_spin_init(&rb->cs_info);
   BLI_spin_init(&rb->cs_management);
-  BLI_spin_init(&rb->render_data_pool.csMem);
+  BLI_spin_init(&rb->render_data_pool.cs_mem);
 
   return rb;
 }
diff --git a/source/blender/draw/engines/lanpr/lanpr_util.c b/source/blender/draw/engines/lanpr/lanpr_util.c
index 22ab6eb3c29..69206edfc19 100644
--- a/source/blender/draw/engines/lanpr/lanpr_util.c
+++ b/source/blender/draw/engines/lanpr/lanpr_util.c
@@ -160,7 +160,7 @@ void *list_push_pointer_sized(ListBase *h, void *data, int size)
   return lip;
 }
 
-void *list_append_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *data)
+void *list_append_pointer_static(ListBase *h, LANPR_StaticMemPool *smp, void *data)
 {
   LinkData *lip;
   if (!h)
@@ -170,7 +170,7 @@ void *list_append_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *data
   BLI_addtail(h, lip);
   return lip;
 }
-void *list_append_pointer_static_sized(ListBase *h, nStaticMemoryPool *smp, void *data, int size)
+void *list_append_pointer_static_sized(ListBase *h, LANPR_StaticMemPool *smp, void *data, int size)
 {
   LinkData *lip;
   if (!h)
@@ -180,7 +180,7 @@ void *list_append_pointer_static_sized(ListBase *h, nStaticMemoryPool *smp, void
   BLI_addtail(h, lip);
   return lip;
 }
-void *list_push_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *data)
+void *list_push_pointer_static(ListBase *h, LANPR_StaticMemPool *smp, void *data)
 {
   LinkData *lip = 0;
   if (!h)
@@ -190,7 +190,7 @@ void *list_push_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *data)
   BLI_addhead(h, lip);
   return lip;
 }
-void *list_push_pointer_static_sized(ListBase *h, nStaticMemoryPool *smp, void *data, int size)
+void *list_push_pointer_static_sized(ListBase *h, LANPR_StaticMemPool *smp, void *data, int size)
 {
   LinkData *lip = 0;
   if (!h)
@@ -301,7 +301,7 @@ void list_generate_pointer_list(ListBase *from1, ListBase *from2, ListBase *to)
   }
 }
 
-void *list_append_pointer_static_pool(nStaticMemoryPool *mph, ListBase *h, void *data)
+void *list_append_pointer_static_pool(LANPR_StaticMemPool *mph, ListBase *h, void *data)
 {
   LinkData *lip;
   if (!h)
@@ -387,55 +387,55 @@ void list_move_down(ListBase *h, Link *li)
     h->last = li;
 }
 
-nStaticMemoryPoolNode *mem_new_static_pool(nStaticMemoryPool *smp)
+LANPR_StaticMemPoolNode *mem_new_static_pool(LANPR_StaticMemPool *smp)
 {
-  nStaticMemoryPoolNode *smpn = MEM_callocN(NUL_MEMORY_POOL_128MB, "mempool");
-  smpn->UsedByte = sizeof(nStaticMemoryPoolNode);
-  BLI_addhead(&smp->Pools, smpn);
+  LANPR_StaticMemPoolNode *smpn = MEM_callocN(NUL_MEMORY_POOL_128MB, "mempool");
+  smpn->used_byte = sizeof(LANPR_StaticMemPoolNode);
+  BLI_addhead(&smp->pools, smpn);
   return smpn;
 }
-void *mem_static_aquire(nStaticMemoryPool *smp, int size)
+void *mem_static_aquire(LANPR_StaticMemPool *smp, int size)
 {
-  nStaticMemoryPoolNode *smpn = smp->Pools.first;
+  LANPR_StaticMemPoolNode *smpn = smp->pools.first;
   void *ret;
 
-  if (!smpn || (smpn->UsedByte + size) > NUL_MEMORY_POOL_128MB)
+  if (!smpn || (smpn->used_byte + size) > NUL_MEMORY_POOL_128MB)
     smpn = mem_new_static_pool(smp);
 
-  ret = ((BYTE *)smpn) + smpn->UsedByte;
+  ret = ((BYTE *)smpn) + smpn->used_byte;
 
-  smpn->UsedByte += size;
+  smpn->used_byte += size;
 
   return ret;
 }
-void *mem_static_aquire_thread(nStaticMemoryPool *smp, int size)
+void *mem_static_aquire_thread(LANPR_StaticMemPool *smp, int size)
 {
-  nStaticMemoryPoolNode *smpn = smp->Pools.first;
+  LANPR_StaticMemPoolNode *smpn = smp->pools.first;
   void *ret;
 
-  BLI_spin_lock(&smp->csMem);
+  BLI_spin_lock(&smp->cs_mem);
 
-  if (!smpn || (smpn->UsedByte + size) > NUL_MEMORY_POOL_128MB)
+  if (!smpn || (smpn->used_byte + size) > NUL_MEMORY_POOL_128MB)
     smpn = mem_new_static_pool(smp);
 
-  ret = ((BYTE *)smpn) + smpn->UsedByte;
+  ret = ((BYTE *)smpn) + smpn->used_byte;
 
-  smpn->UsedByte += size;
+  smpn->used_byte += size;
 
-  BLI_spin_unlock(&smp->csMem);
+  BLI_spin_unlock(&smp->cs_mem);
 
   return ret;
 }
-void *mem_static_destroy(nStaticMemoryPool *smp)
+void *mem_static_destroy(LANPR_StaticMemPool *smp)
 {
-  nStaticMemoryPoolNode *smpn;
+  LANPR_StaticMemPoolNode *smpn;
   void *ret = 0;
 
-  while (smpn = BLI_pophead(&smp->Pools)) {
+  while (smpn = BLI_pophead(&smp->pools)) {
     MEM_freeN(smpn);
   }
 
-  smp->EachSize = 0;
+  smp->each_size = 0;
 
   return ret;
 }
diff --git a/source/blender/draw/engines/lanpr/lanpr_util.h b/source/blender/draw/engines/lanpr/lanpr_util.h
index 1f2b2e32f51..0c2df4b4892 100644
--- a/source/blender/draw/engines/lanpr/lanpr_util.h
+++ b/source/blender/draw/engines/lanpr/lanpr_util.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef __LANPR_UTIL_H__
+#define __LANPR_UTIL_H__
 
 #include <string.h>
 //#include "lanpr_all.h"
@@ -6,16 +7,11 @@
 #include "BLI_linklist.h"
 #include "BLI_threads.h"
 
-/*
-
-   Ported from NUL4.0
-
-   Author(s):WuYiming - xp8110 at outlook.com
-
- */
-
 #define _CRT_SECURE_NO_WARNINGS
+
+#ifndef BYTE
 #define BYTE unsigned char
+#endif
 
 typedef double real;
 typedef unsigned long long u64bit;
@@ -35,66 +31,30 @@ typedef float tnsVector3f[3];
 typedef float tnsVector4f[4];
 typedef int tnsVector2i[2];
 
-#define TNS_PI 3.1415926535897932384626433832795
-#define deg(r) r / TNS_PI * 180.0
-#define rad(d) d *TNS_PI / 180.0
-
+#define deg(r) r / M_PI * 180.0
+#define rad(d) d *M_PI / 180.0
 
 #define DBL_TRIANGLE_LIM 1e-8
 #define DBL_EDGE_LIM 1e-9
 
-
 #define NUL_MEMORY_POOL_1MB 1048576
 #define NUL_MEMORY_POOL_128MB 134217728
 #define NUL_MEMORY_POOL_256MB 268435456
 #define NUL_MEMORY_POOL_512MB 536870912
 
-typedef struct _Link2 
-{
-  void *O1;
-  void *O2;
-  void *pNext;
-  void *pPrev;
-}_Link2;
-
-typedef struct nMemoryPool
-{
-  Link Item;
-  int NodeSize;
-  int CountPerPool;
-  ListBase Pools;
-}nMemoryPool;
-
-typedef struct nMemoryPoolPart
-{
-  Link Item;
-  ListBase MemoryNodes;
-  ListBase FreeMemoryNodes;
-  nMemoryPool *PoolRoot;
-  //  <------Mem Begin Here.
-}nMemoryPoolPart;
-
-typedef struct nMemoryPoolNode
-{
-  Link Item;
-  nMemoryPoolPart *InPool;
-  void *DBInst;
-  //  <------User Mem Begin Here
-}nMemoryPoolNode;
-
-typedef struct nStaticMemoryPoolNode
+typedef struct LANPR_StaticMemPoolNode
 {
-  Link Item;
-  int UsedByte;
+  Link item;
+  int used_byte;
   //  <----------- User Mem Start Here
-}nStaticMemoryPoolNode;
+}LANPR_StaticMemPoolNode;
 
-typedef struct nStaticMemoryPool
+typedef struct LANPR_StaticMemPool
 {
-  int EachSize;
-  ListBase Pools;
-  SpinLock csMem;
-}nStaticMemoryPool;
+  int each_size;
+  ListBase pools;
+  SpinLock cs_mem;
+}LANPR_StaticMemPool;
 
 #define CreateNew(Type) MEM_callocN(sizeof(Type), "VOID")  // nutCalloc(sizeof(Type),1)
 
@@ -128,10 +88,10 @@ void *list_append_pointer_sized(ListBase *h, void *p, int size);
 void *list_push_pointer(ListBase *h, void *p);
 void *list_push_pointer_sized(ListBase *h, void *p, int size);
 
-void *list_append_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *p);
-void *list_append_pointer_static_sized(ListBase *h, nStaticMemoryPool *smp, void *p, int size);
-void *list_push_pointer_static(ListBase *h, nStaticMemoryPool *smp, void *p);
-void *list_push_pointer_static_sized(ListBase *h, nStaticMemoryPool *smp, void *p, int size);
+void *list_append_pointer_static(ListBase *h, LANPR_StaticMemPool *smp, void *p);
+void *list_append_pointer_static_sized(ListBase *h, LANPR_StaticMemPool *smp, void *p, int size);
+void *

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list