Browse Source

Revert "win-capture: Track gl "swap" invocations to prevent duplicate work"

This reverts commit 4c505e7030f2f0b7dab9c51125ac45cf3c28adb1.

Reverting this for the time being due to issues with quakelive.  This
will be more thoroughly tested and hopefully added again.
jp9000 9 years ago
parent
commit
d7ed0f1976
1 changed files with 12 additions and 27 deletions
  1. 12 27
      plugins/win-capture/graphics-hook/gl-capture.c

+ 12 - 27
plugins/win-capture/graphics-hook/gl-capture.c

@@ -30,7 +30,6 @@ static struct func_hook wgl_delete_context;
 static bool darkest_dungeon_fix = false;
 
 struct gl_data {
-	int                            swap_recurse;
 	HDC                            hdc;
 	uint32_t                       base_cx;
 	uint32_t                       base_cy;
@@ -774,36 +773,20 @@ static void gl_capture(HDC hdc)
 	}
 }
 
-static inline void gl_swap_begin(HDC hdc)
-{
-	if (data.swap_recurse++)
-		return;
-
-	if (!global_hook_info->capture_overlay)
-		gl_capture(hdc);
-}
-
-static inline void gl_swap_end(HDC hdc)
-{
-	if (--data.swap_recurse)
-		return;
-
-	if (global_hook_info->capture_overlay)
-		gl_capture(hdc);
-}
-
 static BOOL WINAPI hook_swap_buffers(HDC hdc)
 {
 	BOOL ret;
 
-	gl_swap_begin(hdc);
+	if (!global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	unhook(&swap_buffers);
 	BOOL (WINAPI *call)(HDC) = swap_buffers.call_addr;
 	ret = call(hdc);
 	rehook(&swap_buffers);
 
-	gl_swap_end(hdc);
+	if (global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	return ret;
 }
@@ -812,15 +795,16 @@ static BOOL WINAPI hook_wgl_swap_buffers(HDC hdc)
 {
 	BOOL ret;
 
-	gl_swap_begin(hdc);
+	if (!global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	unhook(&wgl_swap_buffers);
-
 	BOOL (WINAPI *call)(HDC) = wgl_swap_buffers.call_addr;
 	ret = call(hdc);
 	rehook(&wgl_swap_buffers);
 
-	gl_swap_end(hdc);
+	if (global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	return ret;
 }
@@ -829,15 +813,16 @@ static BOOL WINAPI hook_wgl_swap_layer_buffers(HDC hdc, UINT planes)
 {
 	BOOL ret;
 
-	gl_swap_begin(hdc);
+	if (!global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	unhook(&wgl_swap_layer_buffers);
-
 	BOOL (WINAPI *call)(HDC, UINT) = wgl_swap_layer_buffers.call_addr;
 	ret = call(hdc, planes);
 	rehook(&wgl_swap_layer_buffers);
 
-	gl_swap_end(hdc);
+	if (global_hook_info->capture_overlay)
+		gl_capture(hdc);
 
 	return ret;
 }