[Bf-blender-cvs] [e254cc23b24] temp_bmesh_multires: Code cleanup

Joseph Eagar noreply at git.blender.org
Fri Mar 26 01:18:41 CET 2021


Commit: e254cc23b2429c4770bc8965abade63d8b5e22a7
Author: Joseph Eagar
Date:   Thu Mar 25 11:32:20 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBe254cc23b2429c4770bc8965abade63d8b5e22a7

Code cleanup

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

M	intern/cycles/kernel/kernel_compat_cuda.h
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	source/blender/blenkernel/BKE_collection.h
M	source/blender/blenkernel/BKE_lib_id.h
M	source/blender/blenkernel/intern/subdiv_eval.c
M	source/blender/blenlib/intern/BLI_mempool.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/gpu/intern/gpu_buffers.c
D	source/blender/render/RE_render_ext.h
D	source/blender/render/RE_shader_ext.h
D	source/blender/render/intern/bake_api.c
D	source/blender/render/intern/external_engine.c

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

diff --git a/intern/cycles/kernel/kernel_compat_cuda.h b/intern/cycles/kernel/kernel_compat_cuda.h
index da74d6aafac..ea3b78b7cef 100644
--- a/intern/cycles/kernel/kernel_compat_cuda.h
+++ b/intern/cycles/kernel/kernel_compat_cuda.h
@@ -41,18 +41,6 @@ typedef unsigned long long uint64_t;
 typedef unsigned short half;
 typedef unsigned long long CUtexObject;
 
-//XXX fix compiler error on windows
-#ifdef __CUDA_ARCH__
-static __device__ float myfloor(float f) {
-  float f2 = (float)((int)f);
-  f2 += (float)(f < 0.0f);
-
-  return f2;
-}
-
-#define floor myfloor
-#endif
-
 #ifdef CYCLES_CUBIN_CC
 #  define FLT_MIN 1.175494350822287507969e-38f
 #  define FLT_MAX 340282346638528859811704183484516925440.0f
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 199fbbb7479..cfc1041da19 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -58,38 +58,6 @@ extern "C" {
 __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
 }
 
-#include <thread>
-static void thread_cb(
-    GHOST_WIN32_WTInfo info, unsigned int a, unsigned int b, void *dest, int *status, int *ret)
-{
-  *ret = info(a, b, dest);
-  *status = 1;
-}
-
-static unsigned int call_wt_info(GHOST_WIN32_WTInfo info,
-                                 unsigned int a,
-                                 unsigned int b,
-                                 void *dest)
-{
-  static int status = 0;
-  static int ret = 0;
-
-  std::thread thread(thread_cb, info, a, b, dest, &status, &ret);
-
-  std::this_thread::sleep_for(std::chrono::milliseconds(750));
-
-  if (!status) {
-    fprintf(stderr, "failed to initialize wintab properly\n");
-    thread.detach();
-    return 0;
-  }
-  else {
-    thread.join();
-  }
-
-  return ret;
-}
-
 GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
                                      const char *title,
                                      GHOST_TInt32 left,
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index b9b87b1e687..d0fca5e3796 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -26,8 +26,6 @@
 #include "BLI_sys_types.h"
 
 #include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-#include "BKE_lib_id.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -73,8 +71,8 @@ bool BKE_collection_delete(struct Main *bmain, struct Collection *collection, bo
 struct Collection *BKE_collection_duplicate(struct Main *bmain,
                                             struct Collection *parent,
                                             struct Collection *collection,
-                                            const eDupli_ID_Flags duplicate_flags,
-                                            const eLibIDDuplicateFlags duplicate_options);
+                                            const uint duplicate_flags,
+                                            const uint duplicate_options);
 
 /* Master Collection for Scene */
 
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h
index f6dd3e4fdfc..5a8d36b94ec 100644
--- a/source/blender/blenkernel/BKE_lib_id.h
+++ b/source/blender/blenkernel/BKE_lib_id.h
@@ -46,7 +46,6 @@
  */
 
 #include "BLI_compiler_attrs.h"
-#include "DNA_userdef_types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -244,7 +243,7 @@ struct ID *BKE_id_copy_ex(struct Main *bmain,
                           const int flag);
 struct ID *BKE_id_copy_for_duplicate(struct Main *bmain,
                                      struct ID *id,
-                                     const eDupli_ID_Flags duplicate_flags);
+                                     const uint duplicate_flags);
 
 void BKE_lib_id_swap(struct Main *bmain, struct ID *id_a, struct ID *id_b);
 void BKE_lib_id_swap_full(struct Main *bmain, struct ID *id_a, struct ID *id_b);
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c
index b858c847a68..201d308e096 100644
--- a/source/blender/blenkernel/intern/subdiv_eval.c
+++ b/source/blender/blenkernel/intern/subdiv_eval.c
@@ -174,13 +174,6 @@ void BKE_subdiv_eval_limit_point(
   BKE_subdiv_eval_limit_point_and_derivatives(subdiv, ptex_face_index, u, v, r_P, NULL, NULL);
 }
 
-#if 0
-static bool close_zero(float c[3]) {
-  const float eps = 0.00001;
-  return fabs(c[0]) < eps && fabs(c[1]) < eps && fabs(c[2]) < eps; 
-}
-#endif
-
 void BKE_subdiv_eval_limit_point_and_derivatives(Subdiv *subdiv,
                                                  const int ptex_face_index,
                                                  const float u,
@@ -203,7 +196,6 @@ void BKE_subdiv_eval_limit_point_and_derivatives(Subdiv *subdiv,
    * that giving totally unusable derivatives. */
 
   if (r_dPdu != NULL && r_dPdv != NULL) {
-    //if ((close_zero(r_dPdu) || close_zero(r_dPdv)) || equals_v3v3(r_dPdu, r_dPdv)) {
     if ((is_zero_v3(r_dPdu) || is_zero_v3(r_dPdv)) || equals_v3v3(r_dPdu, r_dPdv)) {
       subdiv->evaluator->evaluateLimit(subdiv->evaluator,
                                        ptex_face_index,
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index d4d5d772197..75f934c1fb8 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -37,7 +37,6 @@
 #include "BLI_utildefines.h"
 
 #include "BLI_mempool.h" /* own include */
-#include "BLI_asan.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -224,18 +223,13 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool,
     while (j--) {
       curnode->next = NODE_STEP_NEXT(curnode);
       curnode->freeword = FREEWORD;
-
-      BLI_freenode *next = curnode->next;
-      //BLI_asan_poison(curnode, pool->esize);
-      curnode = next;
+      curnode = curnode->next;
     }
   }
   else {
     while (j--) {
       curnode->next = NODE_STEP_NEXT(curnode);
-      BLI_freenode *next = curnode->next;
-      ////BLI_asan_poison(curnode, pool->esize);
-      curnode = next;
+      curnode = curnode->next;
     }
   }
 
@@ -256,20 +250,18 @@ static BLI_freenode *mempool_chunk_add(BLI_mempool *pool,
   return curnode;
 }
 
-static void mempool_chunk_free(BLI_mempool *pool, BLI_mempool_chunk *mpchunk)
+static void mempool_chunk_free(BLI_mempool_chunk *mpchunk)
 {
-  //BLI_asan_unpoison(mpchunk, sizeof(BLI_mempool_chunk) + pool->esize*pool->csize);
-  
   MEM_freeN(mpchunk);
 }
 
-static void mempool_chunk_free_all(BLI_mempool *pool, BLI_mempool_chunk *mpchunk)
+static void mempool_chunk_free_all(BLI_mempool_chunk *mpchunk)
 {
   BLI_mempool_chunk *mpchunk_next;
 
   for (; mpchunk; mpchunk = mpchunk_next) {
     mpchunk_next = mpchunk->next;
-    mempool_chunk_free(pool, mpchunk);
+    mempool_chunk_free(mpchunk);
   }
 }
 
@@ -351,8 +343,6 @@ void *BLI_mempool_alloc(BLI_mempool *pool)
 
   free_pop = pool->free;
 
-  //BLI_asan_unpoison(free_pop, pool->esize);
-
   BLI_assert(pool->chunk_tail->next == NULL);
 
   if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
@@ -414,9 +404,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
     newhead->freeword = FREEWORD;
   }
 
-
   newhead->next = pool->free;
-
   pool->free = newhead;
 
   pool->totused--;
@@ -433,7 +421,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
     BLI_mempool_chunk *first;
 
     first = pool->chunks;
-    mempool_chunk_free_all(pool, first->next);
+    mempool_chunk_free_all(first->next);
     first->next = NULL;
     pool->chunk_tail = first;
 
@@ -451,20 +439,15 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
 
     j = pool->pchunk;
     while (j--) {
-      BLI_freenode *next = NODE_STEP_NEXT(curnode);
-      curnode->next = next;
-      //BLI_asan_poison(curnode, pool->esize);
-      curnode = next;
+      curnode->next = NODE_STEP_NEXT(curnode);
+      curnode = curnode->next;
     }
     curnode = NODE_STEP_PREV(curnode);
     curnode->next = NULL; /* terminate the list */
-   // BLI_asan_poison(newhead, pool->esize);
 
 #ifdef WITH_MEM_VALGRIND
     VALGRIND_MEMPOOL_FREE(pool, CHUNK_DATA(first));
 #endif
-  } else {
-    //BLI_asan_poison(newhead, pool->esize);
   }
 }
 
@@ -739,7 +722,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
 
     do {
       mpchunk_next = mpchunk->next;
-      mempool_chunk_free(pool, mpchunk);
+      mempool_chunk_free(mpchunk);
     } while ((mpchunk = mpchunk_next));
   }
 
@@ -773,7 +756,7 @@ void BLI_mempool_clear(BLI_mempool *pool)
  */
 void BLI_mempool_destroy(BLI_mempool *pool)
 {
-  mempool_chunk_free_all(pool, pool->chunks);
+  mempool_chunk_free_all(pool->chunks);
 
 #ifdef WITH_MEM_VALGRIND
   VALGRIND_DESTROY_MEMPOOL(pool);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 4b9cfba1620..b27a2520a7c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1325,7 +1325,7 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob, PBVHNode *node, Sculpt
         /* Before any vertex values get modified, ensure their
          * original positions are logged. */
         BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_ALL) {
-          void *dummy;
+          float *dummy;
           BKE_pbvh_bmesh_update_origvert(ss->pbvh, vd.bm_vert, &dummy, &dummy, &dummy);
           // BM_log_vert_before_modified(ss->bm_log, vd.bm_vert, vd.cd_vert_mask_offset, false);
         }
@@ -1352,7 +1352,7 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob, PBVHNode *node, Sculpt
       case SCULPT_UNDO_COLOR: {
 #if 1
         BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_ALL) {
-          void *dummy;
+          float *dummy;
           BKE_pbvh_bmesh_update_origvert(ss->pbvh, vd.bm_vert, NULL, NULL, &dummy);
         }
         BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 0567bcadc7c..9670f5c5c18 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -912,7 +912,7 @@ void GPU_pbvh_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list