mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-22 22:45:39 +00:00
Log OpenGL context resets
This commit is contained in:
@@ -1854,7 +1854,12 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
//else if (msg.type == SDL_MOUSELEAVE) // Does SDL support this??
|
//else if (msg.type == SDL_MOUSELEAVE) // Does SDL support this??
|
||||||
// m_mouseIsInClientArea = false;
|
// m_mouseIsInClientArea = false;
|
||||||
else if (msg.type == SDL_RENDER_DEVICE_RESET || msg.type == SDL_RENDER_TARGETS_RESET)
|
else if (msg.type == SDL_RENDER_DEVICE_RESET || msg.type == SDL_RENDER_TARGETS_RESET)
|
||||||
|
{
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Triggering GL context reset due to device loss (Type: %i)", static_cast<int>(msg.type));
|
||||||
|
|
||||||
m_contextLost = true;
|
m_contextLost = true;
|
||||||
|
}
|
||||||
|
|
||||||
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
|
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
|
||||||
|
|
||||||
@@ -1868,6 +1873,9 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
else
|
else
|
||||||
BecomeWindowed();
|
BecomeWindowed();
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Triggering GL context reset due to fullscreen state change");
|
||||||
|
|
||||||
m_contextLost = true;
|
m_contextLost = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1881,6 +1889,9 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
unsigned int desiredHeight = clientHeight;
|
unsigned int desiredHeight = clientHeight;
|
||||||
if (desiredWidth != m_windowWidthPhysical || desiredHeight != m_windowHeightPhysical || m_isResolutionResetDesired)
|
if (desiredWidth != m_windowWidthPhysical || desiredHeight != m_windowHeightPhysical || m_isResolutionResetDesired)
|
||||||
{
|
{
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Detected window size change");
|
||||||
|
|
||||||
uint32_t prevWidthPhysical = m_windowWidthPhysical;
|
uint32_t prevWidthPhysical = m_windowWidthPhysical;
|
||||||
uint32_t prevHeightPhysical = m_windowHeightPhysical;
|
uint32_t prevHeightPhysical = m_windowHeightPhysical;
|
||||||
uint32_t prevWidthVirtual = m_windowWidthVirtual;
|
uint32_t prevWidthVirtual = m_windowWidthVirtual;
|
||||||
@@ -1912,6 +1923,9 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeightVirtual;
|
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeightVirtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Triggering GL context reset due to window size change");
|
||||||
|
|
||||||
m_contextLost = true;
|
m_contextLost = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1919,6 +1933,9 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
|
|
||||||
if (m_contextLost)
|
if (m_contextLost)
|
||||||
{
|
{
|
||||||
|
if (logger)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Resetting OpenGL context");
|
||||||
|
|
||||||
// Drop everything and reset
|
// Drop everything and reset
|
||||||
m_res.~InstancedResources();
|
m_res.~InstancedResources();
|
||||||
new (&m_res) InstancedResources();
|
new (&m_res) InstancedResources();
|
||||||
@@ -1937,9 +1954,19 @@ void GpDisplayDriver_SDL_GL2::Run()
|
|||||||
|
|
||||||
GpDisplayDriverTickStatus_t tickStatus = PresentFrameAndSync();
|
GpDisplayDriverTickStatus_t tickStatus = PresentFrameAndSync();
|
||||||
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault || tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
|
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault || tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
|
||||||
|
{
|
||||||
|
if (logger)
|
||||||
|
{
|
||||||
|
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Terminating display driver due to fatal fault");
|
||||||
|
if (tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
|
||||||
|
logger->Printf(IGpLogDriver::Category_Information, "Terminating display driver due to application termination");
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Exit
|
// Exit
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user