From 44d9e2d72836bd50495a9cc8ee9c6d15ff836aba Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 18 Jan 2023 14:31:07 +0100 Subject: [PATCH] tests: Distinguish between cross and non-cross Win32 builds. 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 051d34ba..e248ae54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -414,7 +414,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 #include -#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 0f205bfe..8e0ecc1a 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1060,7 +1060,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