Skip to content

Commit de16092

Browse files
committed
update smoke test to cover n4ce case, update 3rdparty/SPIRV-Tools submodule
1 parent 542e0bf commit de16092

File tree

3 files changed

+57
-13
lines changed

3 files changed

+57
-13
lines changed

smoke/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ find_package(Nabla REQUIRED CONFIG
2828

2929
add_executable(smoke main.cpp pch.hpp cdb.ps1)
3030
target_link_libraries(smoke PRIVATE Nabla::Nabla)
31+
target_compile_definitions(smoke PRIVATE _AFXDLL)
3132
target_precompile_headers(smoke PRIVATE pch.hpp)
3233

3334
set(CMAKE_CTEST_ARGUMENTS --verbose)

smoke/main.cpp

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <afxwin.h>
2+
13
#define ENABLE_SMOKE
24

35
using namespace nbl;
@@ -36,45 +38,86 @@ class Smoke final : public system::IApplicationFramework
3638
return false;
3739
}
3840

39-
exportGpuProfiles();
41+
if (!AfxWinInit(GetModuleHandle(nullptr), nullptr, GetCommandLineA(), 0))
42+
{
43+
std::cerr << "[ERROR]: Could not init AFX, terminating!\n";
44+
return false;
45+
}
46+
47+
try {
48+
createAfxDummyWindow(320, 240, nullptr, _T("Dummy 1"));
49+
exportGpuProfiles();
50+
createAfxDummyWindow(320, 240, nullptr, _T("Dummy 2"));
51+
}
52+
catch (const std::exception& e) {
53+
std::cerr << "[ERROR]: " << e.what() << '\n';
54+
return false;
55+
}
56+
catch (...) {
57+
std::cerr << "[ERROR]: Unknown exception!\n";
58+
return false;
59+
}
4060

4161
return true;
4262
}
4363

4464
void workLoopBody() override {}
4565
bool keepRunning() override { return false; }
4666

67+
bool onAppTerminated() override
68+
{
69+
AfxWinTerm();
70+
return true;
71+
}
72+
4773
private:
4874
static void exportGpuProfiles()
4975
{
50-
std::string arg2 = "-o";
51-
std::string buf;
52-
std::string arg1;
53-
std::string arg3;
76+
std::string buf, arg1, arg2 = "-o", arg3;
5477

5578
for (size_t i = 0;; i++)
5679
{
57-
auto stringifiedIndex = std::to_string(i);
58-
arg1 = "--json=" + stringifiedIndex;
59-
arg3 = "device_" + stringifiedIndex + ".json";
60-
std::array<const char*, 3> args = { arg1.data(), arg2.data(), arg3.data() };
80+
auto six = std::to_string(i);
81+
arg1 = "--json=" + six;
82+
arg3 = "device_" + six + ".json";
6183

84+
auto args = std::to_array<const char*>({ arg1.data(), arg2.data(), arg3.data()});
6285
int code = nbl::video::vulkaninfo(args);
6386

6487
if (code != 0)
6588
break;
6689

67-
// print out file content
6890
std::ifstream input(arg3);
6991

7092
while (std::getline(input, buf))
71-
{
7293
std::cout << buf << "\n";
73-
}
7494

7595
std::cout << "\n\n";
7696
}
7797
}
98+
99+
static bool createAfxDummyWindow(int w, int h, HWND parent, LPCTSTR windowName)
100+
{
101+
CWnd wnd;
102+
LPCTSTR cls = AfxRegisterWndClass(0, ::LoadCursor(nullptr, IDC_ARROW));
103+
if (!cls) return false;
104+
105+
if (!wnd.CreateEx(0, cls, windowName, WS_POPUP | WS_VISIBLE, 0, 0, w, h, parent, nullptr))
106+
return false;
107+
108+
MSG msg {};
109+
const ULONGLONG end = GetTickCount64() + 1000;
110+
while (GetTickCount64() < end) {
111+
while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
112+
TranslateMessage(&msg);
113+
DispatchMessage(&msg);
114+
}
115+
Sleep(1);
116+
}
117+
118+
wnd.DestroyWindow();
119+
return true;
120+
}
78121
};
79122

80123
NBL_MAIN_FUNC(Smoke)

0 commit comments

Comments
 (0)