From: Giovanni Mascellani giovanni@mascellani.eu
--- Makefile.am | 4 ++-- tests/shader_runner.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 8c05338b..e8e81de9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -453,7 +453,7 @@ $(CROSS32_EXEFILES): %.cross32.exe: %.c $(CROSS32_IMPLIBS) $(widl_headers)
tests/shader_runner.cross32.exe: $(shader_runner_cross_sources) $(CROSS32_IMPLIBS) $(widl_headers) $(AM_V_CCLD)depbase=`echo $@ | sed 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ - $(CROSS32_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS32_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 && \ + $(CROSS32_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS32_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 -lversion && \ $(am__mv) $$depbase.Tpo $$depbase.Po
else @@ -494,7 +494,7 @@ $(CROSS64_EXEFILES): %.cross64.exe: %.c $(CROSS64_IMPLIBS) $(widl_headers)
tests/shader_runner.cross64.exe: $(shader_runner_cross_sources) $(CROSS64_IMPLIBS) $(widl_headers) $(AM_V_CCLD)depbase=`echo $@ | sed 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ - $(CROSS64_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS64_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 && \ + $(CROSS64_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS64_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 -lversion && \ $(am__mv) $$depbase.Tpo $$depbase.Po
else diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 4750b946..1ac67377 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1064,9 +1064,41 @@ out: vkd3d_test_set_context(NULL); }
+#ifdef _WIN32 +static void print_dll_version(const char *file_name) +{ + DWORD size, handle; + bool done = false; + + size = GetFileVersionInfoSizeA(file_name, &handle); + if (size) + { + char *data = malloc(size); + if (GetFileVersionInfoA(file_name, handle, size, data)) { + VS_FIXEDFILEINFO *pFixedVersionInfo; + UINT len; + if (VerQueryValueA(data, "\", (LPVOID *)&pFixedVersionInfo, &len)) { + trace("%s version: %ld.%ld.%ld.%ld\n", + file_name, + pFixedVersionInfo->dwFileVersionMS >> 16, + pFixedVersionInfo->dwFileVersionMS & 0xffff, + pFixedVersionInfo->dwFileVersionLS >> 16, + pFixedVersionInfo->dwFileVersionLS & 0xffff); + done = true; + } + } + free(data); + } + + if (!done) + trace("%s version: unknown\n", file_name); +} +#endif + START_TEST(shader_runner) { #ifdef _WIN32 + print_dll_version("d3dcompiler_47.dll"); run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else
+#ifdef _WIN32 +static void print_dll_version(const char *file_name) +{ + DWORD size, handle; + bool done = false; + + size = GetFileVersionInfoSizeA(file_name, &handle); + if (size) + { + char *data = malloc(size); + if (GetFileVersionInfoA(file_name, handle, size, data)) { + VS_FIXEDFILEINFO *pFixedVersionInfo; + UINT len; + if (VerQueryValueA(data, "\\", (LPVOID *)&pFixedVersionInfo, &len)) { + trace("%s version: %ld.%ld.%ld.%ld\n", + file_name, + pFixedVersionInfo->dwFileVersionMS >> 16, + pFixedVersionInfo->dwFileVersionMS & 0xffff, + pFixedVersionInfo->dwFileVersionLS >> 16, + pFixedVersionInfo->dwFileVersionLS & 0xffff); + done = true; + } + } + free(data); + } + + if (!done) + trace("%s version: unknown\n", file_name); +} +#endif
This mixes styles, and the most consequential part of that function uses a style that's not the usual vkd3d style at all. Was this perhaps copied a bit too quickly?
Perhaps more significantly, does this work with non-cross Win32 builds of vkd3d? Those builds would link to vkd3d-utils instead of d3dcompiler_47, and while printing the d3dcompiler_47 version anyway in that case might not hurt too much, those builds wouldn't link to the "version" library, right?
Perhaps more significantly, does this work with non-cross Win32 builds of vkd3d? Those builds would link to vkd3d-utils instead of d3dcompiler_47, and while printing the d3dcompiler_47 version anyway in that case might not hurt too much, those builds wouldn't link to the "version" library, right?
That currently doesn't work anyway; we gate all that code on _WIN32 already in d3d12_crosstest.h. Accordingly trying to build the tests fails:
``` whatsit@camazotz:~/git/mingw-vkd3d64$ make tests/d3d12.exe CCLD tests/d3d12.exe /usr/bin/x86_64-w64-mingw32-ld: tests/d3d12.o: in function `create_adapter': /home/whatsit/git/mingw-vkd3d64/../vkd3d/tests/d3d12_crosstest.h:283: undefined reference to `CreateDXGIFactory1' /usr/bin/x86_64-w64-mingw32-ld: tests/d3d12.o: in function `create_device': /home/whatsit/git/mingw-vkd3d64/../vkd3d/tests/d3d12_crosstest.h:311: undefined reference to `D3D12CreateDevice' ... ```
Right, I realised that later while discussing the issue on IRC with Giovanni. That does moot the point somewhat, although ideally we'd fix this of course, or at least try not to make it worse.