windows: fix vsync logspam when window is minimized
This commit is contained in:
parent
4b30bd70d0
commit
ea74114693
|
@ -67,7 +67,7 @@ void oc_vsync_init(void)
|
||||||
adapter = adapterFallback;
|
adapter = adapterFallback;
|
||||||
if(adapter)
|
if(adapter)
|
||||||
{
|
{
|
||||||
oc_log_info("Couldn't find a dedicated hardware DXGI adapater, using software fallback.");
|
oc_log_info("Couldn't find a dedicated hardware DXGI adapater, using software fallback.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void oc_vsync_init(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oc_log_info("Couldn't find any DXGI adapters - vsync will be unavailable.");
|
oc_log_info("Couldn't find any DXGI adapters - vsync will be unavailable.\n");
|
||||||
IDXGIFactory_Release(factory);
|
IDXGIFactory_Release(factory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,14 +92,14 @@ void oc_vsync_wait(oc_window window)
|
||||||
oc_window_data* windowData = oc_window_ptr_from_handle(window);
|
oc_window_data* windowData = oc_window_ptr_from_handle(window);
|
||||||
if(!windowData)
|
if(!windowData)
|
||||||
{
|
{
|
||||||
oc_log_error("Failed to get window ptr - assuming window was closed.");
|
oc_log_error("Failed to get window ptr - assuming window was closed.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT windowRect = { 0 };
|
RECT windowRect = { 0 };
|
||||||
if(GetWindowRect(windowData->win32.hWnd, &windowRect) == FALSE)
|
if(GetWindowRect(windowData->win32.hWnd, &windowRect) == FALSE)
|
||||||
{
|
{
|
||||||
oc_log_error("Failed to get window rect with error: %d.", GetLastError());
|
oc_log_error("Failed to get window rect with error: %d.\n", GetLastError());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ void oc_vsync_wait(oc_window window)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oc_log_error("Failed to get IDXGIOutput desc with error: %d", hr);
|
oc_log_error("Failed to get IDXGIOutput desc with error: %d\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selectedOutput != output)
|
if(selectedOutput != output)
|
||||||
|
@ -143,14 +143,15 @@ void oc_vsync_wait(oc_window window)
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
// TODO(reuben) - fall back to software timer
|
// TODO(reuben) - fall back to software timer
|
||||||
oc_log_warning("Failed to wait for vblank with error: %d", hr);
|
oc_log_warning("Failed to wait for vblank with error: %d\n", hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDXGIOutput_Release(selectedOutput);
|
IDXGIOutput_Release(selectedOutput);
|
||||||
}
|
}
|
||||||
else
|
else if(output)
|
||||||
{
|
{
|
||||||
oc_log_warning("No outputs found. Were all monitors unplugged?");
|
// just use the last output found as a fallback - the window may be minimized or not otherwise visible on any monitor
|
||||||
|
IDXGIOutput_WaitForVBlank(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue