Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/clang/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*'
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-use-anonymous-namespace'
3 changes: 3 additions & 0 deletions tools/clang/test/taef_exec/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ if config.unsupported == False:
if agility_sdk:
extra_params.append('/p:')
extra_params.append('D3D12SDKVersion=1')
extra_params.append('/p:')
extra_params.append('D3D12SDKPath=' + agility_sdk)
print(f"Using Agility SDK from {agility_sdk}")

warp_dll = getattr(config, 'warp_dll', None)
if warp_dll:
Expand Down
49 changes: 14 additions & 35 deletions tools/clang/unittests/HLSLExec/ExecutionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ class ExecutionTest {

dxc::DxCompilerDllLoader m_support;

std::optional<D3D12SDK> D3D12SDK;
bool m_D3DInitCompleted = false;
bool m_ExperimentalModeEnabled = false;
bool m_AgilitySDKEnabled = false;
Expand All @@ -428,46 +429,21 @@ class ExecutionTest {
if (!m_D3DInitCompleted) {
m_D3DInitCompleted = true;

HMODULE hRuntime = LoadLibraryW(L"d3d12.dll");
if (hRuntime == NULL)
D3D12SDK = D3D12SDK::create();
if (!D3D12SDK)
return false;
// Do not: FreeLibrary(hRuntime);
// If we actually free the library, it defeats the purpose of
// enableAgilitySDK and enableExperimentalMode.

HRESULT hr;
hr = enableAgilitySDK(hRuntime);
if (FAILED(hr)) {
LogCommentFmt(L"Unable to enable Agility SDK - 0x%08x.", hr);
} else if (hr == S_FALSE) {
LogCommentFmt(L"Agility SDK not enabled.");
} else {
LogCommentFmt(L"Agility SDK enabled.");
}

hr = enableExperimentalMode(hRuntime);
if (FAILED(hr)) {
LogCommentFmt(L"Unable to enable shader experimental mode - 0x%08x.",
hr);
} else if (hr == S_FALSE) {
LogCommentFmt(L"Experimental mode not enabled.");
} else {
LogCommentFmt(L"Experimental mode enabled.");
}

hr = enableDebugLayer();
if (FAILED(hr)) {
LogCommentFmt(L"Unable to enable debug layer - 0x%08x.", hr);
} else if (hr == S_FALSE) {
LogCommentFmt(L"Debug layer not enabled.");
} else {
LogCommentFmt(L"Debug layer enabled.");
}
}

return true;
}

bool createDevice(ID3D12Device **D3DDevice,
ExecTestUtils::D3D_SHADER_MODEL TestModel =
ExecTestUtils::D3D_SHADER_MODEL_6_0,
bool SkipUnsupported = true) {
return D3D12SDK->createDevice(D3DDevice, TestModel, SkipUnsupported);
}

std::wstring DxcBlobToWide(IDxcBlob *pBlob) {
if (!pBlob)
return std::wstring();
Expand Down Expand Up @@ -12423,7 +12399,9 @@ static void WriteReadBackDump(st::ShaderOp *pShaderOp, st::ShaderOpTest *pTest,
// It's exclusive with the use of the DLL as a TAEF target.
extern "C" {
__declspec(dllexport) HRESULT WINAPI
InitializeOpTests(void *pStrCtx, st::OutputStringFn pOutputStrFn) {
InitializeOpTests([[maybe_unused]] void *pStrCtx,
[[maybe_unused]] st::OutputStringFn pOutputStrFn) {
#ifdef _FORCE_EXPERIMENTAL_SHADERS
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change my view: in the original version of this, enableExperimentalMode will always return S_FALSE and not actually do anything.

Note that InitializeOpTests is called from that GUI thing that's a bit like godbolt, so there won't be any taef runtime params to look at. As far as I can tell, _FORCE_EXPERIMENTAL_SHADERS is never defined.

HMODULE Runtime = LoadLibraryW(L"d3d12.dll");

if (Runtime == NULL)
Expand All @@ -12434,6 +12412,7 @@ __declspec(dllexport) HRESULT WINAPI
if (FAILED(hr)) {
pOutputStrFn(pStrCtx, L"Unable to enable experimental shader models.\r\n.");
}
#endif
return S_OK;
}

Expand Down
Loading
Loading