Skip to content

Commit 6e60e48

Browse files
committed
Move ExecutionTest setup out of area shared with HLK code. (#3682)
(cherry picked from commit 098af75)
1 parent 6e848f6 commit 6e60e48

1 file changed

Lines changed: 24 additions & 31 deletions

File tree

tools/clang/unittests/HLSL/ExecutionTest.cpp

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,29 @@ class ExecutionTest {
443443

444444
const float ClearColor[4] = { 0.0f, 0.2f, 0.4f, 1.0f };
445445

446+
bool DivergentClassSetup() {
447+
HRESULT hr;
448+
hr = EnableExperimentalMode();
449+
if (FAILED(hr)) {
450+
LogCommentFmt(L"Unable to enable shader experimental mode - 0x%08x.", hr);
451+
} else if (hr == S_FALSE) {
452+
LogCommentFmt(L"Experimental mode not enabled.");
453+
} else {
454+
LogCommentFmt(L"Experimental mode enabled.");
455+
}
456+
457+
hr = EnableDebugLayer();
458+
if (FAILED(hr)) {
459+
LogCommentFmt(L"Unable to enable debug layer - 0x%08x.", hr);
460+
} else if (hr == S_FALSE) {
461+
LogCommentFmt(L"Debug layer not enabled.");
462+
} else {
463+
LogCommentFmt(L"Debug layer enabled.");
464+
}
465+
466+
return true;
467+
}
468+
446469
// Do not remove the following line - it is used by TranslateExecutionTest.py
447470
// MARKER: ExecutionTest/DxilConf Shared Implementation Start
448471

@@ -1432,37 +1455,7 @@ static void SetupComputeValuePattern(std::vector<uint32_t> &values,
14321455
}
14331456

14341457
bool ExecutionTest::ExecutionTestClassSetup() {
1435-
HRESULT hr;
1436-
#if !defined(_HLK_CONF) || defined(_HLK_CONF_TEST_EXPERIMENTAL)
1437-
hr = EnableExperimentalMode();
1438-
if (FAILED(hr)) {
1439-
LogCommentFmt(L"Unable to enable shader experimental mode - 0x%08x.", hr);
1440-
} else if (hr == S_FALSE) {
1441-
LogCommentFmt(L"Experimental mode not enabled.");
1442-
} else {
1443-
LogCommentFmt(L"Experimental mode enabled.");
1444-
}
1445-
#endif // !defined(_HLK_CONF) || defined(_HLK_CONF_TEST_EXPERIMENTAL)
1446-
1447-
#ifdef _HLK_CONF
1448-
// TODO: Enabling the D3D driver verifier. Check out the logic in the D3DConf_12_Core test.
1449-
VERIFY_SUCCEEDED(m_support.Initialize());
1450-
m_UseWarp = hlsl_test::GetTestParamUseWARP(false);
1451-
m_EnableDebugLayer = hlsl_test::GetTestParamBool(L"DebugLayer");
1452-
if (m_EnableDebugLayer) {
1453-
EnableDebugLayer();
1454-
}
1455-
return true;
1456-
#else
1457-
hr = EnableDebugLayer();
1458-
if (FAILED(hr)) {
1459-
LogCommentFmt(L"Unable to enable debug layer - 0x%08x.", hr);
1460-
}
1461-
else {
1462-
LogCommentFmt(L"Debug layer enabled.");
1463-
}
1464-
return true;
1465-
#endif
1458+
return DivergentClassSetup();
14661459
}
14671460

14681461
void ExecutionTest::RunRWByteBufferComputeTest(ID3D12Device *pDevice, LPCSTR pShader, std::vector<uint32_t> &values) {

0 commit comments

Comments
 (0)