summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/shared/examplefw.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/rhi/shared/examplefw.h')
-rw-r--r--tests/manual/rhi/shared/examplefw.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/manual/rhi/shared/examplefw.h b/tests/manual/rhi/shared/examplefw.h
index 1a29ef5f7e..4bd087473b 100644
--- a/tests/manual/rhi/shared/examplefw.h
+++ b/tests/manual/rhi/shared/examplefw.h
@@ -126,6 +126,7 @@ int sampleCount = 1;
QRhiSwapChain::Flags scFlags = 0;
QRhi::BeginFrameFlags beginFrameFlags = 0;
QRhi::EndFrameFlags endFrameFlags = 0;
+int framesUntilTdr = -1;
class Window : public QWindow
{
@@ -278,6 +279,10 @@ void Window::init()
if (graphicsApi == D3D11) {
QRhiD3D11InitParams params;
params.enableDebugLayer = true;
+ if (framesUntilTdr > 0) {
+ params.framesUntilKillingDeviceViaTdr = framesUntilTdr;
+ params.repeatDeviceKill = true;
+ }
m_r = QRhi::create(QRhi::D3D11, &params, rhiFlags);
}
#endif
@@ -461,8 +466,17 @@ int main(int argc, char **argv)
// Testing cleanup both with QWindow::close() (hitting X or Alt-F4) and
// QCoreApplication::quit() (e.g. what a menu widget would do) is important.
// Use this parameter for the latter.
- QCommandLineOption sdOption({ "s", "self-destruct" }, QLatin1String("Self destruct after 5 seconds"));
+ QCommandLineOption sdOption({ "s", "self-destruct" }, QLatin1String("Self-destruct after 5 seconds."));
cmdLineParser.addOption(sdOption);
+ // Attempt testing device lost situations on D3D at least.
+ QCommandLineOption tdrOption(QLatin1String("curse"), QLatin1String("Curse the graphics device. "
+ "(generate a device reset every <count> frames when on D3D11)"),
+ QLatin1String("count"));
+ cmdLineParser.addOption(tdrOption);
+ // Allow testing preferring the software adapter (D3D).
+ QCommandLineOption swOption(QLatin1String("software"), QLatin1String("Prefer a software renderer when choosing the adapter. "
+ "Only applicable with some APIs and platforms."));
+ cmdLineParser.addOption(swOption);
cmdLineParser.process(app);
if (cmdLineParser.isSet(nullOption))
@@ -521,6 +535,12 @@ int main(int argc, char **argv)
}
#endif
+ if (cmdLineParser.isSet(tdrOption))
+ framesUntilTdr = cmdLineParser.value(tdrOption).toInt();
+
+ if (cmdLineParser.isSet(swOption))
+ rhiFlags |= QRhi::PreferSoftwareRenderer;
+
// Create and show the window.
Window w;
#if QT_CONFIG(vulkan)