[Bf-blender-cvs] [3ec9ff1] master: Resolve MSVC/OpenMP compat issue

Campbell Barton noreply at git.blender.org
Thu Aug 20 11:42:03 CEST 2015


Commit: 3ec9ff16f888cc30b5fe728953a8368d0a2c0275
Author: Campbell Barton
Date:   Thu Aug 20 19:22:09 2015 +1000
Branches: master
https://developer.blender.org/rB3ec9ff16f888cc30b5fe728953a8368d0a2c0275

Resolve MSVC/OpenMP compat issue

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

M	source/blender/blenkernel/intern/editmesh_bvh.c
M	source/blender/blenlib/BLI_kdopbvh.h
M	source/blender/blenlib/intern/BLI_kdopbvh.c
M	source/blender/python/mathutils/mathutils_bvhtree.c

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

diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c
index f46e158..0e619f2 100644
--- a/source/blender/blenkernel/intern/editmesh_bvh.c
+++ b/source/blender/blenkernel/intern/editmesh_bvh.c
@@ -442,7 +442,7 @@ struct BMBVHTree_OverlapData {
 	float epsilon;
 };
 
-static bool bmbvh_overlap_cb(void *userdata, int index_a, int index_b, unsigned int UNUSED(thread))
+static bool bmbvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
 {
 	struct BMBVHTree_OverlapData *data = userdata;
 	const BMBVHTree *bmtree_a = data->tree_pair[0];
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 6fc93ca..ce7f3ab 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -75,7 +75,7 @@ typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const fl
 typedef void (*BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit);
 
 /* callback to check if 2 nodes overlap (use thread if intersection results need to be stored) */
-typedef bool (*BVHTree_OverlapCallback)(void *userdata, int index_a, int index_b, unsigned int thread);
+typedef bool (*BVHTree_OverlapCallback)(void *userdata, int index_a, int index_b, int thread);
 
 /* callback to range search query */
 typedef void (*BVHTree_RangeQuery)(void *userdata, int index, float dist_sq);
@@ -91,7 +91,7 @@ void BLI_bvhtree_balance(BVHTree *tree);
 bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints);
 void BLI_bvhtree_update_tree(BVHTree *tree);
 
-unsigned int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
+int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
 
 /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
 BVHTreeOverlap *BLI_bvhtree_overlap(
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 81d23a0..d6d0443 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -117,7 +117,7 @@ typedef struct BVHOverlapData_Thread {
 	BVHOverlapData_Shared *shared;
 	struct BLI_Stack *overlap;  /* store BVHTreeOverlap */
 	/* use for callbacks */
-	unsigned int thread;
+	int thread;
 } BVHOverlapData_Thread;
 
 typedef struct BVHNearestData {
@@ -1163,9 +1163,9 @@ static void tree_overlap_traverse_cb(
  *
  * \warning Must be the first tree passed to #BLI_bvhtree_overlap!
  */
-unsigned int BLI_bvhtree_overlap_thread_num(const BVHTree *tree)
+int BLI_bvhtree_overlap_thread_num(const BVHTree *tree)
 {
-	return (unsigned int)MIN2(tree->tree_type, tree->nodes[tree->totleaf]->totnode);
+	return (int)MIN2(tree->tree_type, tree->nodes[tree->totleaf]->totnode);
 }
 
 BVHTreeOverlap *BLI_bvhtree_overlap(
@@ -1173,12 +1173,12 @@ BVHTreeOverlap *BLI_bvhtree_overlap(
         /* optional callback to test the overlap before adding (must be thread-safe!) */
         BVHTree_OverlapCallback callback, void *userdata)
 {
-	const unsigned int thread_num = BLI_bvhtree_overlap_thread_num(tree1);
-	unsigned int j;
+	const int thread_num = BLI_bvhtree_overlap_thread_num(tree1);
+	int j;
 	size_t total = 0;
 	BVHTreeOverlap *overlap = NULL, *to = NULL;
 	BVHOverlapData_Shared data_shared;
-	BVHOverlapData_Thread *data = BLI_array_alloca(data, thread_num);
+	BVHOverlapData_Thread *data = BLI_array_alloca(data, (size_t)thread_num);
 	axis_t start_axis, stop_axis;
 	
 	/* check for compatibility of both trees (can't compare 14-DOP with 18-DOP) */
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c
index a3b1d6d..506b647 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -451,7 +451,7 @@ struct PyBVHTree_OverlapData {
 	float epsilon;
 };
 
-static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, unsigned int UNUSED(thread))
+static bool py_bvhtree_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
 {
 	struct PyBVHTree_OverlapData *data = userdata;
 	PyBVHTree *tree_a = data->tree_pair[0];




More information about the Bf-blender-cvs mailing list