[PATCH vkd3d 05/10] tests: Introduce common header for d3d12 crosstests.

Józef Kucia joseph.kucia at gmail.com
Tue Dec 4 08:55:58 CST 2018


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 tests/d3d12.c            | 41 +-------------------------
 tests/d3d12_crosstest.h  | 63 ++++++++++++++++++++++++++++++++++++++++
 tests/d3d12_test_utils.h |  6 ++--
 3 files changed, 67 insertions(+), 43 deletions(-)
 create mode 100644 tests/d3d12_crosstest.h

diff --git a/tests/d3d12.c b/tests/d3d12.c
index 6f45ac99fd5d..8f9e2c6ce061 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -16,46 +16,7 @@
  * 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
-
-# define _HRESULT_DEFINED
-typedef int HRESULT;
-#endif
-
-#define COBJMACROS
-#define INITGUID
-#include "vkd3d_test.h"
-#include "vkd3d_windows.h"
-#define WIDL_C_INLINE_WRAPPERS
-#include "vkd3d_d3d12.h"
-
-#include <inttypes.h>
-#include <limits.h>
-#include <math.h>
-#include <time.h>
-
-#ifdef _WIN32
-# include "vkd3d_dxgi1_4.h"
-#else
-# include <pthread.h>
-# include "vkd3d_utils.h"
-#endif
-
-#include "d3d12_test_utils.h"
+#include "d3d12_crosstest.h"
 
 struct vec2
 {
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
new file mode 100644
index 000000000000..daf156b15b4a
--- /dev/null
+++ b/tests/d3d12_crosstest.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016-2018 Józef Kucia for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __VKD3D_D3D12_CROSSTEST_H
+#define __VKD3D_D3D12_CROSSTEST_H
+
+/* 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
+
+# define _HRESULT_DEFINED
+typedef int HRESULT;
+#endif
+
+#define COBJMACROS
+#define INITGUID
+#include "vkd3d_test.h"
+#include "vkd3d_windows.h"
+#define WIDL_C_INLINE_WRAPPERS
+#include "vkd3d_d3d12.h"
+
+#include <inttypes.h>
+#include <limits.h>
+#include <math.h>
+#include <time.h>
+
+#ifdef _WIN32
+# include "vkd3d_dxgi1_4.h"
+#else
+# include <pthread.h>
+# include "vkd3d_utils.h"
+#endif
+
+#include "d3d12_test_utils.h"
+
+#endif  /* __VKD3D_D3D12_CROSSTEST_H */
diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h
index c2e7a3d50458..02c5a74e1ac9 100644
--- a/tests/d3d12_test_utils.h
+++ b/tests/d3d12_test_utils.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#ifndef __VKD3D_D3D12_TEST_H
-#define __VKD3D_D3D12_TEST_H
+#ifndef __VKD3D_D3D12_TEST_UTILS_H
+#define __VKD3D_D3D12_TEST_UTILS_H
 
 #define wait_queue_idle(a, b) wait_queue_idle_(__LINE__, a, b)
 static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue);
@@ -769,4 +769,4 @@ static inline D3D12_GPU_DESCRIPTOR_HANDLE get_gpu_sampler_handle(struct test_con
     return get_gpu_handle(context->device, heap, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, offset);
 }
 
-#endif  /* __VKD3D_D3D12_TEST_H */
+#endif  /* __VKD3D_D3D12_TEST_UTILS_H */
-- 
2.19.2




More information about the wine-devel mailing list