diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport_p.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index e050938cc9..2c5d8fb2ac 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -178,6 +178,10 @@ void QSGRhiSupport::applySettings() m_shaderEffectDebug = qEnvironmentVariableIntValue("QSG_RHI_SHADEREFFECT_DEBUG"); + m_killDeviceFrameCount = qEnvironmentVariableIntValue("QSG_RHI_SIMULATE_DEVICE_LOSS"); + if (m_killDeviceFrameCount > 0 && m_rhiBackend == QRhi::D3D11) + qDebug("Graphics device will be reset every %d frames", m_killDeviceFrameCount); + const char *backendName = "unknown"; switch (m_rhiBackend) { case QRhi::Null: @@ -489,6 +493,10 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf if (backend == QRhi::D3D11) { QRhiD3D11InitParams rhiParams; rhiParams.enableDebugLayer = isDebugLayerRequested(); + if (m_killDeviceFrameCount > 0) { + rhiParams.framesUntilKillingDeviceViaTdr = m_killDeviceFrameCount; + rhiParams.repeatDeviceKill = true; + } rhi = QRhi::create(backend, &rhiParams, flags); } #endif diff --git a/src/quick/scenegraph/qsgrhisupport_p.h b/src/quick/scenegraph/qsgrhisupport_p.h index f2d5837bba..536efa55c3 100644 --- a/src/quick/scenegraph/qsgrhisupport_p.h +++ b/src/quick/scenegraph/qsgrhisupport_p.h @@ -138,6 +138,7 @@ private: uint rhi : 1; } m_requested; QRhi::Implementation m_rhiBackend = QRhi::Null; + int m_killDeviceFrameCount; uint m_set : 1; uint m_enableRhi : 1; uint m_debugLayer : 1; |