[Bf-blender-cvs] [0b6603d9b61] blender2.8: Fix selection randomly failing with border render.

Brecht Van Lommel noreply at git.blender.org
Wed May 30 19:39:12 CEST 2018


Commit: 0b6603d9b61007080f66633c7dafe26b33e2ceb7
Author: Brecht Van Lommel
Date:   Wed May 30 19:32:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0b6603d9b61007080f66633c7dafe26b33e2ceb7

Fix selection randomly failing with border render.

We no longer user scissor for 3D viewport drawing, and some selection
code assumed it still. This also cleans up unnecessary scissor test
switching, we only have it temporarily enabled now.

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

M	source/blender/gpu/intern/gpu_select_pick.c
M	source/blender/gpu/intern/gpu_select_sample_query.c
M	source/blender/windowmanager/intern/wm_window.c

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

diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 4aef80934ad..953f6daf805 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -337,7 +337,7 @@ void gpu_select_pick_begin(
 		}
 
 		float viewport[4];
-		glGetFloatv(GL_SCISSOR_BOX, viewport);
+		glGetFloatv(GL_VIEWPORT, viewport);
 
 		ps->src.clip_rect = *input;
 		ps->src.rect_len = rect_len;
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 12390e5cdb0..919ccbea2e9 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -103,10 +103,10 @@ void gpu_select_query_begin(
 	glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 
 	/* In order to save some fill rate we minimize the viewport using rect.
-	 * We need to get the region of the scissor so that our geometry doesn't
+	 * We need to get the region of the viewport so that our geometry doesn't
 	 * get rejected before the depth test. Should probably cull rect against
-	 * scissor for viewport but this is a rare case I think */
-	glGetFloatv(GL_SCISSOR_BOX, viewport);
+	 * the viewport but this is a rare case I think */
+	glGetFloatv(GL_VIEWPORT, viewport);
 	glViewport(viewport[0], viewport[1], BLI_rcti_size_x(input), BLI_rcti_size_y(input));
 
 	/* occlusion queries operates on fragments that pass tests and since we are interested on all
@@ -116,7 +116,6 @@ void gpu_select_query_begin(
 		glDepthMask(GL_FALSE);
 	}
 	else if (mode == GPU_SELECT_NEAREST_FIRST_PASS) {
-		glDisable(GL_SCISSOR_TEST); /* allows fast clear */
 		glClear(GL_DEPTH_BUFFER_BIT);
 		glEnable(GL_DEPTH_TEST);
 		glDepthMask(GL_TRUE);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 0c3d2544bb4..87f280ff706 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -692,7 +692,6 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
 		//GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
 		
 		/* standard state vars for window */
-		glEnable(GL_SCISSOR_TEST);
 		GPU_state_init();
 	}
 }
@@ -2024,13 +2023,7 @@ void wm_window_raise(wmWindow *win)
 
 void wm_window_swap_buffers(wmWindow *win)
 {
-#ifdef WIN32
-	glDisable(GL_SCISSOR_TEST);
 	GHOST_SwapWindowBuffers(win->ghostwin);
-	glEnable(GL_SCISSOR_TEST);
-#else
-	GHOST_SwapWindowBuffers(win->ghostwin);
-#endif
 }
 
 void wm_window_set_swap_interval (wmWindow *win, int interval)



More information about the Bf-blender-cvs mailing list