Make nvidia resets opt-in based on QSurfaceFormat::ResetNotification

We can't be sure every user will check the return value from makeCurrent
and reset appropriately.
Even though after a reset a user will be left with the same garbage as
before, it's safer than a potential infinite loop.

Change-Id: I5b328c654ad2a89c5b8c4399e2eb38150f4f384b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
David Edmundson 2018-04-04 18:31:55 +01:00 committed by Liang Qi
parent 1c463000ed
commit 63a433f6c8

View File

@ -302,7 +302,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
}
if (supportsRobustness && supportsVideoMemoryPurge) {
if (supportsRobustness && supportsVideoMemoryPurge && m_format.testOption(QSurfaceFormat::ResetNotification)) {
QVector<int> contextAttributesWithNvidiaReset = contextAttributes;
contextAttributesWithNvidiaReset << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB;