-
Notifications
You must be signed in to change notification settings - Fork 2
/
directxtest.cpp
114 lines (93 loc) · 2.7 KB
/
directxtest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//-------------------------------------------------------------------------------------
// DirectXTest.cpp
//
// Copyright (c) Microsoft Corporation.
//-------------------------------------------------------------------------------------
#include "directxtest.h"
#include "ShapesGenerator.h"
#include <objbase.h>
#include "UVAtlas.h"
using namespace DirectX;
//-------------------------------------------------------------------------------------
// Types and globals
typedef bool (*TestFN)();
struct TestInfo
{
const char *name;
TestFN func;
};
extern bool Test01();
extern bool Test02();
extern bool Test03();
extern bool Test04();
extern bool Test05();
extern bool Test06();
extern bool Test07();
extern bool Test08();
extern bool Test09();
extern bool Test10();
#ifndef BUILD_BVT_ONLY
extern bool Test11();
#endif
TestInfo g_Tests[] =
{
{ "UVAtlasCreate", Test01 },
{ "UVAtlasPartition", Test02 },
{ "UVAtlasPack", Test03 },
{ "UVAtlasApplyRemap (no duplicates)", Test09 },
{ "UVAtlasApplyRemap (with duplicates)", Test10 },
{ "UVAtlasComputeIMTFromPerVertexSignal", Test04 },
{ "UVAtlasComputeIMTFromSignal", Test05 },
{ "UVAtlasComputeIMTFromTexture", Test06 },
{ "UVAtlasComputeIMTFromPerTexelSignal", Test07 },
#ifndef _M_ARM64
{ "MeshProcess(16)", Test08 },
#ifndef BUILD_BVT_ONLY
{ "MeshProcess(32)", Test11 },
#endif
#endif
};
//-------------------------------------------------------------------------------------
bool RunTests()
{
size_t nPass = 0;
size_t nFail = 0;
for(size_t i=0; i < ( sizeof(g_Tests) / sizeof(TestInfo) ); ++i)
{
print("%s: ", g_Tests[i].name );
if ( g_Tests[i].func() )
{
++nPass;
print("PASS\n");
}
else
{
++nFail;
print("FAIL\n");
}
}
print("Ran %zu tests, %zu pass, %zu fail\n", nPass+nFail, nPass, nFail);
return (nFail == 0);
}
//-------------------------------------------------------------------------------------
int __cdecl main()
{
print("**************************************************************\n");
print("*** " _DIRECTX_TEST_NAME_ " test\n" );
print("*** Library Version %03d\n", UVATLAS_VERSION );
print("**************************************************************\n");
if ( !XMVerifyCPUSupport() )
{
printe("ERROR: XMVerifyCPUSupport fails on this system, not a supported platform\n");
return -1;
}
HRESULT hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
if ( FAILED(hr) )
{
printe("ERROR: CoInitializeEx fails (%08X)\n", static_cast<unsigned int>(hr));
return -1;
}
if ( !RunTests() )
return -1;
return 0;
}