Skip to content

Commit 31ece23

Browse files
authored
Enable Container Builder on *nix (microsoft#4244)
This never got enabled in dxcapi.cpp in spite of all the code to support it being in place. This enables the creation of the interface and enables the tests that were disabled for want of it. As an incidental, correctly defines the REGDB_E_CLASSNOTREG which made the lack of this interface on Linux hard to diagnose.
1 parent 152a762 commit 31ece23

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

tools/clang/tools/dxcompiler/dxcapi.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static HRESULT ThreadMallocDxcCreateInstance(
105105
else if (IsEqualCLSID(rclsid, CLSID_DxcIntelliSense)) {
106106
hr = CreateDxcIntelliSense(riid, ppv);
107107
}
108+
else if (IsEqualCLSID(rclsid, CLSID_DxcContainerBuilder)) {
109+
hr = CreateDxcContainerBuilder(riid, ppv);
110+
}
108111
// Note: The following targets are not yet enabled for non-Windows platforms.
109112
#ifdef _WIN32
110113
else if (IsEqualCLSID(rclsid, CLSID_DxcRewriter)) {
@@ -119,9 +122,6 @@ static HRESULT ThreadMallocDxcCreateInstance(
119122
else if (IsEqualCLSID(rclsid, CLSID_DxcLinker)) {
120123
hr = CreateDxcLinker(riid, ppv);
121124
}
122-
else if (IsEqualCLSID(rclsid, CLSID_DxcContainerBuilder)) {
123-
hr = CreateDxcContainerBuilder(riid, ppv);
124-
}
125125
else if (IsEqualCLSID(rclsid, CLSID_DxcPdbUtils)) {
126126
hr = CreateDxcPdbUtils(riid, ppv);
127127
}

tools/clang/unittests/HLSL/CompilerTest.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,9 @@ class CompilerTest : public ::testing::Test {
281281

282282
void TestPdbUtils(bool bSlim, bool bLegacy, bool bStrip);
283283

284-
#ifdef _WIN32 // No ContainerBuilder support yet
285284
HRESULT CreateContainerBuilder(IDxcContainerBuilder **ppResult) {
286285
return m_dllSupport.CreateInstance(CLSID_DxcContainerBuilder, ppResult);
287286
}
288-
#endif
289287

290288
template <typename T, typename TDefault, typename TIface>
291289
void WriteIfValue(TIface *pSymbol, std::wstringstream &o,
@@ -855,8 +853,6 @@ TEST_F(CompilerTest, CompileWhenWorksThenDisassembleWorks) {
855853
// WEX::Logging::Log::Comment(disassembleStringW.m_psz);
856854
}
857855

858-
#ifdef _WIN32 // Container builder unsupported
859-
860856
TEST_F(CompilerTest, CompileWhenDebugWorksThenStripDebug) {
861857
CComPtr<IDxcCompiler> pCompiler;
862858
CComPtr<IDxcOperationResult> pResult;
@@ -1031,6 +1027,7 @@ TEST_F(CompilerTest, CompileThenAddCustomDebugName) {
10311027
VERIFY_IS_NULL(pPartHeader);
10321028
}
10331029

1030+
#ifdef _WIN32 // No PDBUtil support
10341031
static void VerifyPdbUtil(dxc::DxcDllSupport &dllSupport,
10351032
IDxcBlob *pBlob, IDxcPdbUtils *pPdbUtils,
10361033
const WCHAR *pMainFileName,
@@ -1469,7 +1466,6 @@ static void VerifyPdbUtil(dxc::DxcDllSupport &dllSupport,
14691466
}
14701467
}
14711468

1472-
#ifdef _WIN32
14731469

14741470
TEST_F(CompilerTest, CompileThenTestPdbUtilsStripped) {
14751471
if (m_ver.SkipDxilVersion(1, 5)) return;
@@ -1986,7 +1982,7 @@ TEST_F(CompilerTest, CompileThenTestPdbUtilsEmptyEntry) {
19861982
VERIFY_ARE_EQUAL(pEntryName, L"main");
19871983
}
19881984

1989-
#endif
1985+
#endif // _WIN32 - No PDBUtil support
19901986

19911987
void CompilerTest::TestResourceBindingImpl(
19921988
const char *bindingFileContent,
@@ -2330,6 +2326,7 @@ TEST_F(CompilerTest, CompileWithRootSignatureThenStripRootSignature) {
23302326
VERIFY_IS_NOT_NULL(pPartHeader);
23312327
}
23322328

2329+
#if _WIN32 // API -setrootsignature requires reflection, which isn't supported on non-win
23332330
TEST_F(CompilerTest, CompileThenSetRootSignatureThenValidate) {
23342331
CComPtr<IDxcCompiler> pCompiler;
23352332
VERIFY_SUCCEEDED(CreateCompiler(&pCompiler));
@@ -2464,7 +2461,7 @@ TEST_F(CompilerTest, CompileThenSetRootSignatureThenValidate) {
24642461
pRSBlobReplace->GetBufferPointer(),
24652462
pRSBlob->GetBufferSize()));
24662463
}
2467-
2464+
#endif // _WIN32 - API -setrootsignature requires reflection, which isn't supported on non-win
24682465
TEST_F(CompilerTest, CompileSetPrivateThenWithStripPrivate) {
24692466
CComPtr<IDxcCompiler> pCompiler;
24702467
CComPtr<IDxcOperationResult> pResult;
@@ -2585,7 +2582,6 @@ TEST_F(CompilerTest, CompileWithMultiplePrivateOptionsThenFail) {
25852582
"Cannot specify /Qpdb_in_private and /setprivate together.";
25862583
CheckOperationResultMsgs(pResult, &pErrorMsg2, 1, false, false);
25872584
}
2588-
#endif // Container builder unsupported
25892585

25902586
TEST_F(CompilerTest, CompileWhenIncludeThenLoadInvoked) {
25912587
CComPtr<IDxcCompiler> pCompiler;

tools/clang/unittests/HLSL/DxilContainerTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ bool DxilContainerTest::InitSupport() {
601601
return true;
602602
}
603603

604-
#ifdef _WIN32
604+
#ifdef _WIN32 // - No reflection support
605605
TEST_F(DxilContainerTest, CompileWhenDebugSourceThenSourceMatters) {
606606
char program1[] = "float4 main() : SV_Target { return 0; }";
607607
char program2[] = " float4 main() : SV_Target { return 0; } ";
@@ -658,6 +658,7 @@ TEST_F(DxilContainerTest, CompileWhenDebugSourceThenSourceMatters) {
658658
// Source hash and bin hash should be different
659659
VERIFY_IS_FALSE(0 == strcmp(binHash1Zss.c_str(), binHash1.c_str()));
660660
}
661+
#endif // WIN32 - No reflection support
661662

662663
TEST_F(DxilContainerTest, ContainerBuilder_AddPrivateForceLast) {
663664
if (m_ver.SkipDxilVersion(1, 7)) return;
@@ -754,7 +755,6 @@ TEST_F(DxilContainerTest, ContainerBuilder_AddPrivateForceLast) {
754755
GetPart(pNewContainer, hlsl::DFCC_ShaderDebugInfoDXIL);
755756
VerifyPrivateLast(pNewContainer);
756757
}
757-
#endif // _WIN32
758758

759759
TEST_F(DxilContainerTest, CompileWhenOKThenIncludesSignatures) {
760760
char program[] =

0 commit comments

Comments
 (0)