-- v2: tests: Print d3dcompiler_47.dll version when running tests on Windows. tests: Distinguish between cross and non-cross Win32 builds.
From: Giovanni Mascellani giovanni@mascellani.eu
Now the tests compile correctly on non-cross Win32 builds. --- Makefile.am | 2 +- tests/d3d12_crosstest.h | 4 ++-- tests/shader_runner.c | 2 +- tests/vkd3d_api.c | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 9459bad9..ee1c49e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -411,7 +411,7 @@ dummy-vkd3d-version: ## Cross-compile tests cross_implibs = crosslibs/d3d12 CROSS_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include -CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0 +CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0 -DVKD3D_CROSSTEST=1 EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def) EXTRA_DIST += tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index e6dc7a6c..26f70018 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -56,7 +56,7 @@ typedef int HRESULT; #include <stddef.h> #include <time.h>
-#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST # include "vkd3d_dxgi1_4.h" #else # define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_2 @@ -261,7 +261,7 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm static bool use_warp_device; static unsigned int use_adapter_idx;
-#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST static IUnknown *create_warp_adapter(IDXGIFactory4 *factory) { IUnknown *adapter; diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 4750b946..56ac82f2 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1066,7 +1066,7 @@ out:
START_TEST(shader_runner) { -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c index ab266c4b..5a585fec 100644 --- a/tests/vkd3d_api.c +++ b/tests/vkd3d_api.c @@ -16,6 +16,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+/* Hack for MinGW-w64 headers. + * + * We want to use WIDL C inline wrappers because some methods + * in D3D12 interfaces return aggregate objects. Unfortunately, + * WIDL C inline wrappers are broken when used with MinGW-w64 + * headers because FORCEINLINE expands to extern inline + * which leads to the "multiple storage classes in declaration + * specifiers" compiler error. + */ +#ifdef __MINGW32__ +# include <_mingw.h> +# ifdef __MINGW64_VERSION_MAJOR +# undef __forceinline +# define __forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__)) +# endif +#endif + #define VK_NO_PROTOTYPES #define COBJMACROS #define INITGUID
From: Giovanni Mascellani giovanni@mascellani.eu
--- Makefile.am | 4 ++-- tests/shader_runner.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index ee1c49e5..1322b78d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -455,7 +455,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 @@ -496,7 +496,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 56ac82f2..c9d04c7e 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1064,9 +1064,42 @@ out: vkd3d_test_set_context(NULL); }
+#ifdef VKD3D_CROSSTEST +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 VKD3D_CROSSTEST + print_dll_version("d3dcompiler_47.dll"); run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else
START_TEST(shader_runner) { -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else
Overall this is probably an improvement, but I think that ideally we would run the d3d9 and d3d11 tests on any Win32 build, and always run the Vulkan and d3d12 tests. (Not sure if that's currently feasible; maybe it isn't.)
+ 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; + } + }
Sorry to be a pain about this, but could we please:
- Avoid "pFixedVersionInfo" and just call it "info", "version_info", "file_info", or something along those lines. - Avoid "LPVOID". - Use %u to print unsigned values.
START_TEST(shader_runner) { -#ifdef _WIN32 +#ifdef VKD3D_CROSSTEST run_shader_tests_d3d9(argc, argv); run_shader_tests_d3d11(argc, argv); #else
Overall this is probably an improvement, but I think that ideally we would run the d3d9 and d3d11 tests on any Win32 build, and always run the Vulkan and d3d12 tests. (Not sure if that's currently feasible; maybe it isn't.)
Hmm, should we, though? The counterpoint is that we may want to replace vkd3d_test_platform_is_windows() with something keyed on VKD3D_CROSSTEST, and if so we don't want to run e.g. d3d9 tests unless it's the crosstest.
I'm not sure I completely follow the logic. I guess the interesting thing about the d3d9 and d3d11 tests is that it would be much easier to end up with the Windows D3D + vkd3d-shader configuration, while for the d3d12 tests you'd typically either have Windows D3D + d3dcompiler or vkd3d + vkd3d-shader. (Note though that Wine and the possibility of using native DLLs does complicate that picture a little.) That means we may need to do a better job of distinguishing between Windows D3D and wined3d/vkd3d, separately from distinguishing between d3dcompiler and vkd3d-shader, instead of lumping these together, but that might not be a bad thing anyway?