[PATCH v6] vkd3d: Support using vkd3d-utils path when testing on Windows.
Hans-Kristian Arntzen
post at arntzen-software.no
Mon Nov 18 13:14:07 CST 2019
When testing vkd3d on Windows, we were only able to use the native D3D12
path. Add an ifdef to configure this.
Signed-off-by: Hans-Kristian Arntzen <post at arntzen-software.no>
---
configure.ac | 7 +++++++
tests/d3d12_crosstest.h | 12 +++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 355aaab..4b3bb76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,9 @@ AC_ARG_WITH([spirv-tools], AS_HELP_STRING([--with-spirv-tools],
AC_ARG_ENABLE([demos],
AS_HELP_STRING([--enable-demos], [Build demo programs (default: disabled)]),,
[enable_demos=no])
+AC_ARG_ENABLE([force-utils-wrapper],
+ AS_HELP_STRING([--enable-force-utils-wrapper], [Target vkd3d-utils when targeting Windows (default: disabled)]),,
+ [enable_force_utils_wrapper=no])
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--enable-tests], [Build tests (default: enabled)]),,
[enable_tests=yes])
@@ -113,6 +116,9 @@ AS_IF([test "x$with_xcb" != "xno"],
HAVE_XCB=yes],
[HAVE_XCB=no])])
+AS_IF([test "x$enable_force_utils_wrapper" = "xyes"],
+ [AC_DEFINE([VKD3D_FORCE_UTILS_WRAPPER], [1], [Define to 1 to force usage of vkd3d-utils in d3d12 tests on Windows.])])
+
dnl Check for functions
VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)])
VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popcount(0)])
@@ -147,6 +153,7 @@ AS_ECHO(["
Building demos: ${enable_demos}
Building tests: ${enable_tests}
+ Forcing vkd3d-utils wrapper for tests: ${enable_force_utils_wrapper}
Building crosstests: ${HAVE_CROSSTEST}"])
AS_IF([test "x$CROSSTARGET32" != "xno"], [AS_ECHO([" Using 32-bit cross compiler: $CROSSCC32"])])
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
index 7b59471..1c9b3b2 100644
--- a/tests/d3d12_crosstest.h
+++ b/tests/d3d12_crosstest.h
@@ -19,6 +19,8 @@
#ifndef __VKD3D_D3D12_CROSSTEST_H
#define __VKD3D_D3D12_CROSSTEST_H
+#include "config.h"
+
/* Hack for MinGW-w64 headers.
*
* We want to use WIDL C inline wrappers because some methods
@@ -52,17 +54,17 @@ typedef int HRESULT;
#include <math.h>
#include <time.h>
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(VKD3D_FORCE_UTILS_WRAPPER)
# include "vkd3d_dxgi1_4.h"
#else
-# include <pthread.h>
+# include "vkd3d_threads.h"
# include "vkd3d.h"
# include "vkd3d_utils.h"
#endif
#include "d3d12_test_utils.h"
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(VKD3D_FORCE_UTILS_WRAPPER)
static inline HANDLE create_event(void)
{
return CreateEventA(NULL, FALSE, FALSE, NULL);
@@ -124,7 +126,7 @@ struct test_thread_data
void *user_data;
};
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(VKD3D_FORCE_UTILS_WRAPPER)
static inline DWORD WINAPI test_thread_main(void *untyped_data)
{
struct test_thread_data *data = untyped_data;
@@ -242,7 +244,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
+#if defined(_WIN32) && !defined(VKD3D_FORCE_UTILS_WRAPPER)
static IUnknown *create_warp_adapter(IDXGIFactory4 *factory)
{
IUnknown *adapter;
--
2.24.0
More information about the wine-devel
mailing list