[Bf-blender-cvs] [11c77a5782] temp-select-pick: Remove debugging code

Campbell Barton noreply at git.blender.org
Wed Mar 8 12:01:21 CET 2017


Commit: 11c77a5782e1be16f45e74b03cb0f235c09e46d6
Author: Campbell Barton
Date:   Wed Mar 8 22:02:01 2017 +1100
Branches: temp-select-pick
https://developer.blender.org/rB11c77a5782e1be16f45e74b03cb0f235c09e46d6

Remove debugging code

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

M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/gpu/intern/gpu_select_pick.c

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

diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 6c5b13ec1c..a28f83bdf1 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1240,13 +1240,7 @@ static int mixed_bones_object_selectbuffer(
 	int hits = 0;
 
 	/* we _must_ end cache before return, use 'goto finally' */
-	static int A = 0;
-	A = !A;
-
-	if (A) {
-		GPU_select_cache_begin();
-	}
-	/* GPU_select_cache_begin(); */
+	GPU_select_cache_begin();
 
 	BLI_rcti_init_pt_size(&rect, mval, 14);
 	hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode);
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 7c3989dce1..fe9cfe7a2e 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -55,36 +55,6 @@
 /* Z-depth of cleared depth buffer */
 #define DEPTH_MAX 1.0
 
-#define SEED 5381
-
-static uint64_t hash_u8_r(const char *key, size_t n, uint64_t *r_h)
-{
-	const signed char *p;
-	uint64_t h = *r_h;
-	for (p = (const signed char *)key; n--; p++) {
-		h = (h << 5) + h + (unsigned int)*p;
-	}
-	*r_h = h;
-	return h;
-}
-static uint64_t hash_f32_r(const float *key, size_t n, uint64_t *r_h)
-{
-	return hash_u8_r((const char *)key, n * 4, r_h);
-}
-/*
-static uint64_t hash_u8(const char *key, size_t n)
-{
-	uint64_t h = SEED;
-	return hash_u8_r(key, n, &h);
-}
-*/
-static uint64_t hash_f32(const float *key, size_t n)
-{
-	uint64_t h = SEED;
-	return hash_f32_r(key, n, &h);
-}
-
-
 /* For looping over a sub-region of a rect, could be moved into 'rct.c'*/
 typedef struct SubRectStride {
 	unsigned int start;  /* start here */
@@ -131,6 +101,9 @@ static DepthBufCache *depth_buf_malloc(unsigned int rect_len)
 	return rect;
 }
 
+/**
+ * Both buffers are the same size, just check if the sub-rect contains any differences.
+ */
 static bool depth_buf_subrect_equal(
         const SubRectStride *sub_rect,
         const DepthBufCache *rect_src, const DepthBufCache *rect_dst)
@@ -342,44 +315,6 @@ static void gpu_select_load_id_pass(const DepthBufCache *rect_depth, const Depth
 {
 	GPUPickState *ps = &g_pick_state;
 	const unsigned int prev_id = rect_depth_test->id;
-
-#ifdef DEBUG_PRINT
-	if (ps->is_cached == false) {
-		printf("%s: (%llX, %llX)\n", __func__,
-		       hash_f32(rect_depth->buf, ps->src.rect_len),
-		       hash_f32(rect_depth_test->buf, ps->src.rect_len));
-	}
-	else {
-
-		uint64_t p = SEED;
-		uint64_t c = SEED;
-
-		/* same as above but different rect sizes */
-		const float *prev = rect_depth->buf + ps->cache.sub_rect.start;
-		const float *curr = rect_depth_test->buf + ps->cache.sub_rect.start;
-		bool diff_found = false;
-		for (unsigned int i = 0; i < ps->cache.sub_rect.len; i++) {
-			const float *prev_end = prev + ps->cache.sub_rect.span;
-			for (; prev < prev_end; prev++, curr++) {
-				hash_f32_r(prev, 1, &p);
-				hash_f32_r(curr, 1, &c);
-				if (*prev != *curr) {
-					diff_found = true;
-				}
-			}
-			prev += ps->cache.sub_rect.skip;
-			curr += ps->cache.sub_rect.skip;
-		}
-		if (!diff_found) {
-			return;
-		}
-		printf("%s: (%llX, %llX)\n", __func__,
-			   p,
-			   c);
-	}
-#endif
-
-
 	if (g_pick_state.mode == GPU_SELECT_PICK_SORT_ALL) {
 		/* find the best depth for this pass and store in 'all.hits' */
 		float depth_best = DEPTH_MAX;




More information about the Bf-blender-cvs mailing list