|
@@ -13,6 +13,11 @@
|
|
|
#define UNICODE
|
|
|
#endif
|
|
|
|
|
|
+#ifdef __APPLE__
|
|
|
+// Workaround for ambiguous wcsstr on Mac
|
|
|
+#define _WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
|
|
|
+#endif
|
|
|
+
|
|
|
#include <memory>
|
|
|
#include <vector>
|
|
|
#include <string>
|
|
@@ -22,10 +27,14 @@
|
|
|
#include <algorithm>
|
|
|
#include "dxc/Support/WinIncludes.h"
|
|
|
#include "dxc/dxcapi.h"
|
|
|
+#ifdef _WIN32
|
|
|
#include <atlfile.h>
|
|
|
+#include <d3dcompiler.h>
|
|
|
+#pragma comment(lib, "d3dcompiler.lib")
|
|
|
+#include <filesystem>
|
|
|
+#endif
|
|
|
|
|
|
#include "HLSLTestData.h"
|
|
|
-#include "WexTestClass.h"
|
|
|
#include "HlslTestUtils.h"
|
|
|
#include "DxcTestUtils.h"
|
|
|
|
|
@@ -35,17 +44,14 @@
|
|
|
#include "dxc/HLSL/DxilContainer.h"
|
|
|
|
|
|
#include <fstream>
|
|
|
-#include <filesystem>
|
|
|
#include <chrono>
|
|
|
|
|
|
-#include <d3dcompiler.h>
|
|
|
-#pragma comment(lib, "d3dcompiler.lib")
|
|
|
-
|
|
|
#include <codecvt>
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
using namespace hlsl_test;
|
|
|
+#ifdef _WIN32
|
|
|
using namespace std::experimental::filesystem;
|
|
|
|
|
|
static uint8_t MaskCount(uint8_t V) {
|
|
@@ -58,8 +64,13 @@ static uint8_t MaskCount(uint8_t V) {
|
|
|
};
|
|
|
return Count[V];
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
class DxilContainerTest {
|
|
|
+#else
|
|
|
+class DxilContainerTest : public ::testing::Test {
|
|
|
+#endif
|
|
|
public:
|
|
|
BEGIN_TEST_CLASS(DxilContainerTest)
|
|
|
TEST_CLASS_PROPERTY(L"Parallel", L"true")
|
|
@@ -104,6 +115,7 @@ public:
|
|
|
return m_dllSupport.CreateInstance(CLSID_DxcCompiler, ppResult);
|
|
|
}
|
|
|
|
|
|
+#ifdef _WIN32 // - Reflection Unsupported
|
|
|
void CompareShaderInputBindDesc(D3D12_SHADER_INPUT_BIND_DESC *pTestDesc,
|
|
|
D3D12_SHADER_INPUT_BIND_DESC *pBaseDesc) {
|
|
|
VERIFY_ARE_EQUAL(pTestDesc->BindCount, pBaseDesc->BindCount);
|
|
@@ -321,6 +333,7 @@ public:
|
|
|
VERIFY_ARE_EQUAL(testZ, baseZ);
|
|
|
}
|
|
|
}
|
|
|
+#endif // _WIN32 - Reflection unsupported
|
|
|
|
|
|
void split(const wstring &s, wchar_t delim, vector<wstring> &elems) {
|
|
|
wstringstream ss(s);
|
|
@@ -359,6 +372,7 @@ public:
|
|
|
parts.push_back(P);
|
|
|
}
|
|
|
|
|
|
+#ifdef _WIN32 // - Reflection unsupported
|
|
|
HRESULT CompileFromFile(LPCWSTR path, bool useDXBC, IDxcBlob **ppBlob) {
|
|
|
std::vector<FileRunCommandPart> parts;
|
|
|
//NameParseCommandPartsFromFile(path, parts);
|
|
@@ -408,6 +422,7 @@ public:
|
|
|
D3DReflect(pBlob->GetBufferPointer(), pBlob->GetBufferSize(),
|
|
|
__uuidof(ID3D12ShaderReflection), (void **)ppReflection));
|
|
|
}
|
|
|
+#endif // _WIN32 - Reflection unsupported
|
|
|
|
|
|
void CompileToProgram(LPCSTR program, LPCWSTR entryPoint, LPCWSTR target,
|
|
|
LPCWSTR *pArguments, UINT32 argCount,
|
|
@@ -489,6 +504,7 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef _WIN32 // Reflection unsupported
|
|
|
WEX::Common::String WStrFmt(const wchar_t* msg, ...) {
|
|
|
va_list args;
|
|
|
va_start(args, msg);
|
|
@@ -520,8 +536,10 @@ public:
|
|
|
|
|
|
CompareReflection(pProgramReflection, pProgramReflectionDXBC);
|
|
|
}
|
|
|
+#endif // _WIN32 - Reflection unsupported
|
|
|
};
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
TEST_F(DxilContainerTest, CompileWhenDebugSourceThenSourceMatters) {
|
|
|
char program1[] = "float4 main() : SV_Target { return 0; }";
|
|
|
char program2[] = " float4 main() : SV_Target { return 0; } ";
|
|
@@ -558,6 +576,7 @@ TEST_F(DxilContainerTest, CompileWhenDebugSourceThenSourceMatters) {
|
|
|
VERIFY_ARE_EQUAL_STR(binName1.c_str(), binName2.c_str());
|
|
|
VERIFY_IS_FALSE(0 == strcmp(sourceName1Zss.c_str(), binName1.c_str()));
|
|
|
}
|
|
|
+#endif // _WIN32
|
|
|
|
|
|
TEST_F(DxilContainerTest, CompileWhenOKThenIncludesSignatures) {
|
|
|
char program[] =
|
|
@@ -892,6 +911,7 @@ HRESULT HlslFileVariables::SetFromText(_In_count_(len) const char *pText, size_t
|
|
|
return S_OK;
|
|
|
}
|
|
|
|
|
|
+#ifdef _WIN32 // Reflection unsupported
|
|
|
TEST_F(DxilContainerTest, ReflectionMatchesDXBC_CheckIn) {
|
|
|
WEX::TestExecution::SetVerifyOutput verifySettings(WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
|
|
|
ReflectionTest(hlsl_test::GetPathToHlslDataFile(L"..\\CodeGenHLSL\\Samples\\DX11\\SimpleBezier11DS.hlsl").c_str(), false);
|
|
@@ -944,6 +964,7 @@ TEST_F(DxilContainerTest, ReflectionMatchesDXBC_Full) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+#endif // _WIN32 - Reflection unsupported
|
|
|
|
|
|
TEST_F(DxilContainerTest, ValidateFromLL_Abs2) {
|
|
|
CodeGenTestCheck(L"abs2_m.ll");
|