Skip to content

Commit 7b28802

Browse files
authored
Updated D3d12info to 3.14.1. Added options for auto submit and custom warp version. (#74)
1 parent 0378faf commit 7b28802

File tree

10 files changed

+145
-44
lines changed

10 files changed

+145
-44
lines changed

source/GUI/html/default.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/GUI/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html><head><title>D3d12infoGUI Report</title><meta charset="UTF-8"><script src="reports.js"></script><link rel="icon" type="image/png" href="84cce981575dbdc0fe40.png" sizes="96x96"/><link rel="icon" type="image/svg+xml" href="favicon.svg"/><link rel="shortcut icon" href="01dd40ee699a7c61060b.ico"/><link rel="apple-touch-icon" sizes="180x180" href="b0669e145449e7ec0cf7.png"/><link rel="manifest" href="ca84030c52cc08023014.webmanifest"/><script defer="defer" src="default.js"></script></head><body><noscript>This app requires JavaScript to run</noscript><div class="header"><div style="width:.5em"></div><div class="headerText">D3d12infoGUI Report</div><div style="width:1em"></div><a class="headerLink" href="https://d3d12infodb.boolka.dev/"><div class="headerText">Online Database</div><img class="icon" src="database.svg"></a><div style="width:1em"></div><div class="flexRight"><a class="headerLink" href="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/Devaniti/D3d12infoGUI"><div class="headerText">D3d12infoGUI on GitHub</div><img class="icon" src="github-mark.svg"></a><div style="width:.5em"></div><a class="headerLink" href="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/sawickiap/D3d12info"><div class="headerText">D3d12info on GitHub</div><img class="icon" src="github-mark.svg"></a><div style="width:.5em"></div><div class="headerLink gui-tooltip"><div class="headerText">About</div><img class="tooltipicon" src="info.svg"><div class="gui-tooltiptext" style="width:35vw;left:70%;transform:translateX(-100%)">D3d12infoGUI is a tool for querying support for various Direct3D 12 features.<br>In this report you can find data about all D3D12 capable GPUs in your local machine.<br>There's also community-driven online database listing same information for various hardware which you can open via "Online Database" link in the header.<br>You can submit your reports to the online database with one of the submit buttons if database doesn't contain equivalent data already.<br>If database contains equivalent report, or if you just submitted one of your reports, you can then open it online and share the link to your report.<br>Those reports don't contain any personal information, you can see full contents of those reports on this page before submitting.</div></div></div><div style="width:.5em"></div></div><main><div class="ReportTable"><div id="ListContainer"></div><div id="SearchBarPropertiesContainer"></div><div id="HeaderContainer"></div><div id="ReportContainer"></div></div></main></body></html>
1+
<!doctype html><html><head><title>D3d12infoGUI Report</title><meta charset="UTF-8"><script src="data.js"></script><link rel="icon" type="image/png" href="84cce981575dbdc0fe40.png" sizes="96x96"/><link rel="icon" type="image/svg+xml" href="favicon.svg"/><link rel="shortcut icon" href="01dd40ee699a7c61060b.ico"/><link rel="apple-touch-icon" sizes="180x180" href="b0669e145449e7ec0cf7.png"/><link rel="manifest" href="ca84030c52cc08023014.webmanifest"/><script defer="defer" src="default.js"></script></head><body><noscript>This app requires JavaScript to run</noscript><div class="header"><div style="width:.5em"></div><div class="headerText">D3d12infoGUI Report</div><div style="width:1em"></div><a class="headerLink" href="https://d3d12infodb.boolka.dev/"><div class="headerText">Online Database</div><img class="icon" src="database.svg"></a><div style="width:1em"></div><div class="flexRight"><a class="headerLink" href="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/Devaniti/D3d12infoGUI"><div class="headerText">D3d12infoGUI on GitHub</div><img class="icon" src="github-mark.svg"></a><div style="width:.5em"></div><a class="headerLink" href="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/sawickiap/D3d12info"><div class="headerText">D3d12info on GitHub</div><img class="icon" src="github-mark.svg"></a><div style="width:.5em"></div><div class="headerLink gui-tooltip"><div class="headerText">About</div><img class="tooltipicon" src="info.svg"><div class="gui-tooltiptext" style="width:35vw;left:70%;transform:translateX(-100%)">D3d12infoGUI is a tool for querying support for various Direct3D 12 features.<br>In this report you can find data about all D3D12 capable GPUs in your local machine.<br>There's also community-driven online database listing same information for various hardware which you can open via "Online Database" link in the header.<br>You can submit your reports to the online database with one of the submit buttons if database doesn't contain equivalent data already.<br>If database contains equivalent report, or if you just submitted one of your reports, you can then open it online and share the link to your report.<br>Those reports don't contain any personal information, you can see full contents of those reports on this page before submitting.</div></div></div><div style="width:.5em"></div></div><main><div class="ReportTable"><div id="ListContainer"></div><div id="SearchBarPropertiesContainer"></div><div id="HeaderContainer"></div><div id="ReportContainer"></div></div></main></body></html>

source/GUI/private/main.cpp

Lines changed: 109 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77

88
using namespace D3d12infoGUI;
99

10+
// Command line flags
11+
static bool g_OpenLicenses = false;
12+
static bool g_OpenHelp = false;
13+
static bool g_AutoSubmit = false;
14+
static std::wstring g_CustomWarpPath;
15+
static bool g_CLIArgumentsError = false;
16+
1017
int RunGUI(HINSTANCE hInstance)
1118
{
1219
Window window(hInstance, L"Extracting files");
@@ -40,11 +47,22 @@ int RunGUI(HINSTANCE hInstance)
4047
std::vector<std::vector<char>> validReports;
4148

4249
std::wstring d3d12infoCmdLine = std::format(
43-
L"\"{}\" --OutputFile=\"{}\" --AllAdapters --JSON --MinimizeJson --Formats --EnableExperimental=OFF",
50+
L"\"{}\" --OutputFile=\"{}\" --JSON --MinimizeJson --Formats --EnableExperimental=OFF",
4451
d3d12infoPath.wstring(), d3d12infoReport.wstring());
4552
std::wstring d3d12infoPreviewCmdLine =
46-
std::format(L"\"{}\" --OutputFile=\"{}\" --AllAdapters --JSON --MinimizeJson --Formats --EnableExperimental=ON",
53+
std::format(L"\"{}\" --OutputFile=\"{}\" --JSON --MinimizeJson --Formats --EnableExperimental=ON",
4754
d3d12infoPreviewPath.wstring(), d3d12infoPreviewReport.wstring());
55+
if(g_CustomWarpPath.empty())
56+
{
57+
d3d12infoCmdLine += L" --AllAdapters";
58+
d3d12infoPreviewCmdLine += L" --AllAdapters";
59+
}
60+
else
61+
{
62+
std::filesystem::copy_file(g_CustomWarpPath, rootPath / "d3d10warp.dll", std::filesystem::copy_options::overwrite_existing);
63+
d3d12infoCmdLine += L" --WARP";
64+
d3d12infoPreviewCmdLine += L" --WARP";
65+
}
4866

4967
Subprocess d3d12infoProcess(d3d12infoCmdLine.data());
5068
Subprocess d3d12infoPreviewProcess(d3d12infoPreviewCmdLine.data());
@@ -74,7 +92,10 @@ int RunGUI(HINSTANCE hInstance)
7492

7593
window.ReportProgress(L"Generating report");
7694

77-
ReportGenerator::GenerateHTML(rootPath, validReports);
95+
OpenOptions options{};
96+
options.AutoSubmit = g_AutoSubmit;
97+
98+
ReportGenerator::GenerateHTML(rootPath, validReports, options);
7899
if(window.IsExitRequested())
79100
return 1;
80101
window.ReportProgress(L"Opening report");
@@ -146,43 +167,107 @@ void OpenLicenses()
146167
#endif
147168
}
148169

149-
int ProcessCommandLine(LPWSTR lpCmdLine)
170+
void ParseCommandLine()
150171
{
151-
if(std::wcscmp(lpCmdLine, L"--licenses") == 0 || std::wcscmp(lpCmdLine, L"-l") == 0)
152-
{
153-
OpenLicenses();
154-
return 0;
155-
}
172+
int argc = 0;
173+
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
174+
if(!argv)
175+
return;
156176

157-
if(std::wcscmp(lpCmdLine, L"--help") == 0 || std::wcscmp(lpCmdLine, L"-h") == 0)
177+
for(int i = 1; i < argc; ++i)
158178
{
159-
PrintHelp();
160-
return 0;
161-
}
179+
LPWSTR arg = argv[i];
180+
if(std::wcscmp(arg, L"--license") == 0 || std::wcscmp(arg, L"-l") == 0)
181+
{
182+
g_OpenLicenses = true;
183+
continue;
184+
}
162185

163-
PrintHelp();
164-
return 1;
165-
}
186+
if(std::wcscmp(arg, L"--help") == 0 || std::wcscmp(arg, L"-h") == 0)
187+
{
188+
g_OpenHelp = true;
189+
continue;
190+
}
166191

167-
int RunCommandLine(LPWSTR lpCmdLine)
168-
{
169-
InitializeConsole();
192+
if(std::wcscmp(arg, L"--auto-submit") == 0 || std::wcscmp(arg, L"-a") == 0)
193+
{
194+
g_AutoSubmit = true;
195+
continue;
196+
}
197+
198+
// --custom-warp=PATH
199+
constexpr wchar_t warpLongArgPrefix[] = L"--custom-warp=";
200+
constexpr size_t warpLongArgLen = sizeof(warpLongArgPrefix) / sizeof(wchar_t) - 1;
201+
if(std::wcsncmp(arg, warpLongArgPrefix, warpLongArgLen) == 0)
202+
{
203+
g_CustomWarpPath = std::wstring(arg + warpLongArgLen);
204+
continue;
205+
}
170206

171-
int result = ProcessCommandLine(lpCmdLine);
207+
// -w=PATH
208+
constexpr wchar_t warpShortArgPrefix[] = L"-w=";
209+
constexpr size_t warpShortArgLen = sizeof(warpShortArgPrefix) / sizeof(wchar_t) - 1;
210+
if(std::wcsncmp(arg, warpShortArgPrefix, warpShortArgLen) == 0)
211+
{
212+
g_CustomWarpPath = std::wstring(arg + warpShortArgLen);
213+
continue;
214+
}
215+
216+
// --custom-warp PATH / -w PATH
217+
if(std::wcscmp(arg, L"--custom-warp") == 0 || std::wcscmp(arg, L"-w") == 0)
218+
{
219+
if(i + 1 >= argc)
220+
{
221+
g_CLIArgumentsError = true;
222+
break;
223+
}
224+
225+
g_CustomWarpPath = std::wstring(argv[++i]);
226+
continue;
227+
}
172228

173-
::FreeConsole();
229+
g_CLIArgumentsError = true;
230+
break;
231+
}
174232

175-
return result;
233+
if (g_CustomWarpPath.size() > 2)
234+
{
235+
size_t beginPos = 0;
236+
size_t endPos = g_CustomWarpPath.size();
237+
if (g_CustomWarpPath[beginPos] == L'"')
238+
{
239+
++beginPos;
240+
}
241+
if (g_CustomWarpPath[endPos - 1] == L'"')
242+
{
243+
--endPos;
244+
}
245+
g_CustomWarpPath = g_CustomWarpPath.substr(beginPos, endPos - beginPos);
246+
}
247+
248+
LocalFree(argv);
176249
}
177250

178251
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
179252
{
180253
try
181254
{
182-
if(*lpCmdLine != L'\0')
255+
ParseCommandLine();
256+
257+
if(g_CLIArgumentsError || g_OpenHelp)
183258
{
184-
return RunCommandLine(lpCmdLine);
259+
InitializeConsole();
260+
PrintHelp();
261+
::FreeConsole();
262+
return g_CLIArgumentsError ? 1 : 0;
185263
}
264+
265+
if(g_OpenLicenses)
266+
{
267+
OpenLicenses();
268+
return 0;
269+
}
270+
186271
return RunGUI(hInstance);
187272
}
188273
catch(const std::exception& e)

source/GUI/private/report_generator.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace D3d12infoGUI
66
{
77

8-
void ReportGenerator::GenerateHTML(
9-
const std::filesystem::path& rootPath, const std::vector<std::vector<char>>& validReports)
8+
void ReportGenerator::GenerateHTML(const std::filesystem::path& rootPath,
9+
const std::vector<std::vector<char>>& validReports, const OpenOptions& options)
1010
{
1111
if(!std::filesystem::is_directory(rootPath))
1212
{
@@ -16,15 +16,17 @@ namespace D3d12infoGUI
1616
}
1717
}
1818

19-
std::filesystem::path jsFilePath = rootPath / L"reports.js";
20-
std::ofstream jsonFile;
21-
jsonFile.open(jsFilePath, std::ios_base::out | std::ios_base::binary);
22-
if(jsonFile.fail())
19+
std::filesystem::path jsFilePath = rootPath / L"data.js";
20+
std::ofstream dataFile;
21+
dataFile.open(jsFilePath, std::ios_base::out | std::ios_base::binary);
22+
if(dataFile.fail())
2323
{
2424
throw std::runtime_error("Failed to open output file");
2525
}
2626

27-
jsonFile << "const reports = [";
27+
dataFile << std::format("const openOptions = {{autoSubmit: {}}}\n", options.AutoSubmit);
28+
29+
dataFile << "const reports = [";
2830
bool isFirst = true;
2931
for(const auto& report : validReports)
3032
{
@@ -34,15 +36,15 @@ namespace D3d12infoGUI
3436
}
3537
else
3638
{
37-
jsonFile << ",";
39+
dataFile << ",";
3840
}
3941

40-
jsonFile.write(report.data(), report.size());
42+
dataFile.write(report.data(), report.size());
4143
}
42-
jsonFile << "]";
44+
dataFile << "]";
4345

44-
jsonFile.close();
45-
if(jsonFile.fail())
46+
dataFile.close();
47+
if(dataFile.fail())
4648
{
4749
throw std::runtime_error("Failed to write output file");
4850
}

source/GUI/private/report_generator.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44

55
namespace D3d12infoGUI
66
{
7+
struct OpenOptions
8+
{
9+
bool AutoSubmit = false;
10+
};
11+
712
class ReportGenerator
813
{
914
public:
10-
static void GenerateHTML(
11-
const std::filesystem::path& rootPath, const std::vector<std::vector<char>>& validReports);
15+
static void GenerateHTML(const std::filesystem::path& rootPath,
16+
const std::vector<std::vector<char>>& validReports, const OpenOptions& options);
1217
};
1318
} // namespace D3d12infoGUI

source/external/D3d12info

Submodule D3d12info updated 50 files

source/frontend/assets/html_gui/reports.js renamed to source/frontend/assets/html_gui/data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const openOptions = {autoSubmit: false}
12
const reports = [{
23
"Header": {
34
"Program": "D3d12info",

source/frontend/assets/html_gui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<title>D3d12infoGUI Report</title>
66
<meta charset="UTF-8">
7-
<script type="text/javascript" src="reports.js"></script>
7+
<script type="text/javascript" src="data.js"></script>
88

99
<%- include('../favicon/favicon_header.html') %>
1010
</head>

source/frontend/assets/js/gui.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,19 @@ function UpdateReport() {
274274
}
275275

276276
function QueryReportIDs() {
277+
let adapterCount = 0;
278+
IterateAdapters(() => {++adapterCount});
279+
let responseCount = 0;
277280
IterateAdapters((retailIndex, index, adapter) => {
278281
SubmissionIDs[retailIndex][index] = null;
279282
Server.IsSubmitted(Headers[retailIndex], adapter, (ID) => {
280283
SubmissionIDs[retailIndex][index] = ID;
281284
UpdateList();
285+
++responseCount;
286+
if (openOptions.autoSubmit && responseCount == adapterCount)
287+
{
288+
SubmitAllReports();
289+
}
282290
})
283291
})
284292
}

source/frontend/gui-webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ module.exports = (env, argv) => {
2626
options: {
2727
sources: {
2828
urlFilter: (attribute, value, resourcePath) => {
29-
if (attribute === 'src' && value == 'reports.js') {
30-
// Do not include reports.js when packing for GUI
29+
if (attribute === 'src' && value == 'data.js') {
30+
// Do not include data.js when packing for GUI
3131
// But do include it when running dev server
3232
return isDevServer;
3333
}

0 commit comments

Comments
 (0)