rhi: d3d11: Drop the built-in TDR test
This does not really belong here as a built-in feature, esp. considering that such testing is relevant for other backends as well. Change-Id: Ifbe3b8c6a430aacb9fcbdabf0e3761b14c48decc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
9ac0742d36
commit
c6b7737436
@ -404,7 +404,6 @@ qt_internal_extend_target(Gui CONDITION WIN32
|
||||
platform/windows/qwindowsguieventdispatcher.cpp platform/windows/qwindowsguieventdispatcher_p.h
|
||||
platform/windows/qwindowsmimeconverter.h platform/windows/qwindowsmimeconverter.cpp
|
||||
platform/windows/qwindowsnativeinterface.cpp
|
||||
rhi/cs_tdr_p.h
|
||||
rhi/qrhid3d11.cpp rhi/qrhid3d11_p.h
|
||||
rhi/qrhid3d11_p_p.h
|
||||
rhi/vs_test_p.h
|
||||
|
@ -1,192 +0,0 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#ifndef CS_TDR_P_H
|
||||
#define CS_TDR_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of other Qt classes. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#include <qt_windows.h>
|
||||
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
|
||||
//
|
||||
//
|
||||
// Buffer Definitions:
|
||||
//
|
||||
// cbuffer ConstantBuffer
|
||||
// {
|
||||
//
|
||||
// uint zero; // Offset: 0 Size: 4
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// Resource Bindings:
|
||||
//
|
||||
// Name Type Format Dim HLSL Bind Count
|
||||
// ------------------------------ ---------- ------- ----------- -------------- ------
|
||||
// uav UAV uint buf u0 1
|
||||
// ConstantBuffer cbuffer NA NA cb0 1
|
||||
//
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// no Input
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// no Output
|
||||
cs_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_constantbuffer CB0[1], immediateIndexed
|
||||
dcl_uav_typed_buffer (uint,uint,uint,uint) u0
|
||||
dcl_input vThreadID.x
|
||||
dcl_thread_group 256, 1, 1
|
||||
loop
|
||||
breakc_nz cb0[0].x
|
||||
store_uav_typed u0.xyzw, vThreadID.xxxx, cb0[0].xxxx
|
||||
endloop
|
||||
ret
|
||||
// Approximately 5 instruction slots used
|
||||
#endif
|
||||
|
||||
inline constexpr BYTE g_killDeviceByTimingOut[] =
|
||||
{
|
||||
68, 88, 66, 67, 217, 62,
|
||||
220, 38, 136, 51, 86, 245,
|
||||
161, 96, 18, 35, 141, 17,
|
||||
26, 13, 1, 0, 0, 0,
|
||||
164, 2, 0, 0, 5, 0,
|
||||
0, 0, 52, 0, 0, 0,
|
||||
100, 1, 0, 0, 116, 1,
|
||||
0, 0, 132, 1, 0, 0,
|
||||
8, 2, 0, 0, 82, 68,
|
||||
69, 70, 40, 1, 0, 0,
|
||||
1, 0, 0, 0, 144, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
60, 0, 0, 0, 0, 5,
|
||||
83, 67, 0, 1, 0, 0,
|
||||
0, 1, 0, 0, 82, 68,
|
||||
49, 49, 60, 0, 0, 0,
|
||||
24, 0, 0, 0, 32, 0,
|
||||
0, 0, 40, 0, 0, 0,
|
||||
36, 0, 0, 0, 12, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
124, 0, 0, 0, 4, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
1, 0, 0, 0, 255, 255,
|
||||
255, 255, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 0, 0,
|
||||
0, 0, 128, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 117, 97,
|
||||
118, 0, 67, 111, 110, 115,
|
||||
116, 97, 110, 116, 66, 117,
|
||||
102, 102, 101, 114, 0, 171,
|
||||
128, 0, 0, 0, 1, 0,
|
||||
0, 0, 168, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
208, 0, 0, 0, 0, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
2, 0, 0, 0, 220, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
255, 255, 255, 255, 0, 0,
|
||||
0, 0, 255, 255, 255, 255,
|
||||
0, 0, 0, 0, 122, 101,
|
||||
114, 111, 0, 100, 119, 111,
|
||||
114, 100, 0, 171, 0, 0,
|
||||
19, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
213, 0, 0, 0, 77, 105,
|
||||
99, 114, 111, 115, 111, 102,
|
||||
116, 32, 40, 82, 41, 32,
|
||||
72, 76, 83, 76, 32, 83,
|
||||
104, 97, 100, 101, 114, 32,
|
||||
67, 111, 109, 112, 105, 108,
|
||||
101, 114, 32, 49, 48, 46,
|
||||
49, 0, 73, 83, 71, 78,
|
||||
8, 0, 0, 0, 0, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
79, 83, 71, 78, 8, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
8, 0, 0, 0, 83, 72,
|
||||
69, 88, 124, 0, 0, 0,
|
||||
80, 0, 5, 0, 31, 0,
|
||||
0, 0, 106, 8, 0, 1,
|
||||
89, 0, 0, 4, 70, 142,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 156, 8,
|
||||
0, 4, 0, 224, 17, 0,
|
||||
0, 0, 0, 0, 68, 68,
|
||||
0, 0, 95, 0, 0, 2,
|
||||
18, 0, 2, 0, 155, 0,
|
||||
0, 4, 0, 1, 0, 0,
|
||||
1, 0, 0, 0, 1, 0,
|
||||
0, 0, 48, 0, 0, 1,
|
||||
3, 0, 4, 4, 10, 128,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 164, 0,
|
||||
0, 7, 242, 224, 17, 0,
|
||||
0, 0, 0, 0, 6, 0,
|
||||
2, 0, 6, 128, 32, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 22, 0, 0, 1,
|
||||
62, 0, 0, 1, 83, 84,
|
||||
65, 84, 148, 0, 0, 0,
|
||||
5, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0
|
||||
};
|
||||
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#endif // CS_TDR_P_H
|
@ -4,7 +4,6 @@
|
||||
#include "qrhid3d11_p_p.h"
|
||||
#include "qshader_p.h"
|
||||
#include "vs_test_p.h"
|
||||
#include "cs_tdr_p.h"
|
||||
#include <QWindow>
|
||||
#include <qmath.h>
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
@ -97,14 +96,10 @@ using namespace Qt::StringLiterals;
|
||||
#endif
|
||||
|
||||
QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importParams)
|
||||
: ofr(this),
|
||||
deviceCurse(this)
|
||||
: ofr(this)
|
||||
{
|
||||
debugLayer = params->enableDebugLayer;
|
||||
|
||||
deviceCurse.framesToActivate = params->framesUntilKillingDeviceViaTdr;
|
||||
deviceCurse.permanent = params->repeatDeviceKill;
|
||||
|
||||
if (importParams) {
|
||||
if (importParams->dev && importParams->context) {
|
||||
dev = reinterpret_cast<ID3D11Device *>(importParams->dev);
|
||||
@ -316,9 +311,6 @@ bool QRhiD3D11::create(QRhi::Flags flags)
|
||||
nativeHandlesStruct.adapterLuidLow = adapterLuid.LowPart;
|
||||
nativeHandlesStruct.adapterLuidHigh = adapterLuid.HighPart;
|
||||
|
||||
if (deviceCurse.framesToActivate > 0)
|
||||
deviceCurse.initResources();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -336,8 +328,6 @@ void QRhiD3D11::destroy()
|
||||
|
||||
clearShaderCache();
|
||||
|
||||
deviceCurse.releaseResources();
|
||||
|
||||
if (annotations) {
|
||||
annotations->Release();
|
||||
annotations = nullptr;
|
||||
@ -1328,19 +1318,6 @@ QRhi::FrameOpResult QRhiD3D11::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
|
||||
swapChainD->frameCount += 1;
|
||||
contextState.currentSwapChain = nullptr;
|
||||
|
||||
if (deviceCurse.framesToActivate > 0) {
|
||||
deviceCurse.framesLeft -= 1;
|
||||
if (deviceCurse.framesLeft == 0) {
|
||||
deviceCurse.framesLeft = deviceCurse.framesToActivate;
|
||||
if (!deviceCurse.permanent)
|
||||
deviceCurse.framesToActivate = -1;
|
||||
|
||||
deviceCurse.activate();
|
||||
} else if (deviceCurse.framesLeft % 100 == 0) {
|
||||
qDebug("Impending doom: %d frames left", deviceCurse.framesLeft);
|
||||
}
|
||||
}
|
||||
|
||||
return QRhi::FrameOpSuccess;
|
||||
}
|
||||
|
||||
@ -5153,35 +5130,4 @@ bool QD3D11SwapChain::createOrResize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QRhiD3D11::DeviceCurse::initResources()
|
||||
{
|
||||
framesLeft = framesToActivate;
|
||||
|
||||
HRESULT hr = q->dev->CreateComputeShader(g_killDeviceByTimingOut, sizeof(g_killDeviceByTimingOut), nullptr, &cs);
|
||||
if (FAILED(hr)) {
|
||||
qWarning("Failed to create compute shader: %s",
|
||||
qPrintable(QSystemError::windowsComString(hr)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void QRhiD3D11::DeviceCurse::releaseResources()
|
||||
{
|
||||
if (cs) {
|
||||
cs->Release();
|
||||
cs = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void QRhiD3D11::DeviceCurse::activate()
|
||||
{
|
||||
if (!cs)
|
||||
return;
|
||||
|
||||
qDebug("Activating Curse. Goodbye Cruel World.");
|
||||
|
||||
q->context->CSSetShader(cs, nullptr, 0);
|
||||
q->context->Dispatch(256, 1, 1);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -790,19 +790,6 @@ public:
|
||||
};
|
||||
QHash<QRhiShaderStage, Shader> m_shaderCache;
|
||||
|
||||
struct DeviceCurse {
|
||||
DeviceCurse(QRhiD3D11 *impl) : q(impl) { }
|
||||
QRhiD3D11 *q;
|
||||
int framesToActivate = -1;
|
||||
bool permanent = false;
|
||||
int framesLeft = 0;
|
||||
ID3D11ComputeShader *cs = nullptr;
|
||||
|
||||
void initResources();
|
||||
void releaseResources();
|
||||
void activate();
|
||||
} deviceCurse;
|
||||
|
||||
// This is what gets exposed as the "pipeline cache", not that that concept
|
||||
// applies anyway. Here we are just storing the DX bytecode for a shader so
|
||||
// we can skip the HLSL->DXBC compilation when the QShader has HLSL source
|
||||
|
@ -1,9 +0,0 @@
|
||||
RWBuffer<uint> uav;
|
||||
cbuffer ConstantBuffer { uint zero; }
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void killDeviceByTimingOut(uint3 id: SV_DispatchThreadID)
|
||||
{
|
||||
while (zero == 0)
|
||||
uav[id.x] = zero;
|
||||
}
|
@ -83,7 +83,6 @@ int sampleCount = 1;
|
||||
QRhiSwapChain::Flags scFlags;
|
||||
QRhi::BeginFrameFlags beginFrameFlags;
|
||||
QRhi::EndFrameFlags endFrameFlags;
|
||||
int framesUntilTdr = -1;
|
||||
bool transparentBackground = false;
|
||||
bool debugLayer = true;
|
||||
|
||||
@ -243,10 +242,6 @@ void Window::init()
|
||||
if (debugLayer)
|
||||
qDebug("Enabling D3D11 debug layer");
|
||||
params.enableDebugLayer = debugLayer;
|
||||
if (framesUntilTdr > 0) {
|
||||
params.framesUntilKillingDeviceViaTdr = framesUntilTdr;
|
||||
params.repeatDeviceKill = true;
|
||||
}
|
||||
m_r = QRhi::create(QRhi::D3D11, ¶ms, rhiFlags);
|
||||
} else if (graphicsApi == D3D12) {
|
||||
QRhiD3D12InitParams params;
|
||||
@ -414,12 +409,7 @@ int main(int argc, char **argv)
|
||||
cmdLineParser.addOption(sdOption);
|
||||
QCommandLineOption coreProfOption({ "c", "core" }, QLatin1String("Request a core profile context for OpenGL"));
|
||||
cmdLineParser.addOption(coreProfOption);
|
||||
// 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).
|
||||
// Allow testing preferring the software adapter (D3D, Vulkan).
|
||||
QCommandLineOption swOption(QLatin1String("software"), QLatin1String("Prefer a software renderer when choosing the adapter. "
|
||||
"Only applicable with some APIs and platforms."));
|
||||
cmdLineParser.addOption(swOption);
|
||||
@ -499,9 +489,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cmdLineParser.isSet(tdrOption))
|
||||
framesUntilTdr = cmdLineParser.value(tdrOption).toInt();
|
||||
|
||||
if (cmdLineParser.isSet(swOption))
|
||||
rhiFlags |= QRhi::PreferSoftwareRenderer;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user