[Bf-blender-cvs] [2096efa32f] temp-select-pick: Avoid initial buffer read, fill with 1.0

Campbell Barton noreply at git.blender.org
Tue Mar 7 20:18:51 CET 2017


Commit: 2096efa32f8842a4d56e861d43fa25e34b29b2c9
Author: Campbell Barton
Date:   Wed Mar 8 06:20:10 2017 +1100
Branches: temp-select-pick
https://developer.blender.org/rB2096efa32f8842a4d56e861d43fa25e34b29b2c9

Avoid initial buffer read, fill with 1.0

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

M	source/blender/gpu/intern/gpu_select_pick.c

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

diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index bdaa58985e..d5fbf17df6 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -239,8 +239,14 @@ void gpu_select_pick_begin(
 		ps->gl.is_init = false;
 		ps->gl.prev_id = 0;
 
-		/* TODO, find exact value this will be and write into it (clip-far?) */
+		/* set initial 'far' value */
+#if 0
 		glReadPixels(UNPACK4(ps->gl.clip_readpixels), GL_DEPTH_COMPONENT, GL_FLOAT, ps->gl.rect_depth->buf);
+#else
+		for (unsigned int i = 0; i < rect_len; i++) {
+			ps->gl.rect_depth->buf[i] = 1.0;
+		}
+#endif
 
 		if (mode == GPU_SELECT_PICK_SORT_ALL) {
 			glEnable(GL_DEPTH_TEST);
@@ -433,7 +439,8 @@ unsigned int gpu_select_pick_end(void)
 		ps->all.hits = NULL;
 		ps->all.hits_len = 0;
 		ps->all.hits_len_alloc = 0;
-	} else {
+	}
+	else {
 		/* GPU_SELECT_PICK_SORT_NEAREST */
 
 		/* Over alloc (unlikely we have as many depths as pixels) */




More information about the Bf-blender-cvs mailing list