[PATCH vkd3d 7/9] vkd3d-utils: Detect surface extensions at runtime.

Józef Kucia joseph.kucia at gmail.com
Fri Aug 17 02:57:01 CDT 2018


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

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 Makefile.am                            |  1 -
 libs/vkd3d-utils/vkd3d_utils_main.c    | 16 ++++++++++++----
 libs/vkd3d-utils/vkd3d_utils_private.h |  9 +++------
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 79e31553cb7c..3ee2f130c50d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,7 +106,6 @@ libvkd3d_utils_la_SOURCES = \
 	libs/vkd3d-utils/vkd3d_utils.map \
 	libs/vkd3d-utils/vkd3d_utils_main.c \
 	libs/vkd3d-utils/vkd3d_utils_private.h
-libvkd3d_utils_la_CFLAGS = @XCB_CFLAGS@
 libvkd3d_utils_la_LDFLAGS = -version-info 1:0:0
 libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d.la
 if HAVE_LD_VERSION_SCRIPT
diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c
index 8c2503784e37..fa6e5f8f1616 100644
--- a/libs/vkd3d-utils/vkd3d_utils_main.c
+++ b/libs/vkd3d-utils/vkd3d_utils_main.c
@@ -28,15 +28,18 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug)
 HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter,
         D3D_FEATURE_LEVEL minimum_feature_level, REFIID iid, void **device)
 {
+    struct vkd3d_optional_instance_extensions_info optional_extensions_info;
     struct vkd3d_instance_create_info instance_create_info;
     struct vkd3d_device_create_info device_create_info;
 
     static const char * const instance_extensions[] =
     {
         VK_KHR_SURFACE_EXTENSION_NAME,
-#ifdef HAVE_XCB
-        VK_KHR_XCB_SURFACE_EXTENSION_NAME,
-#endif
+    };
+    static const char * const optional_instance_extensions[] =
+    {
+        "VK_KHR_xcb_surface",
+        "VK_MVK_macos_surface",
     };
     static const char * const device_extensions[] =
     {
@@ -49,9 +52,14 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter,
     if (adapter)
         FIXME("Ignoring adapter %p.\n", adapter);
 
+    memset(&optional_extensions_info, 0, sizeof(optional_extensions_info));
+    optional_extensions_info.type = VKD3D_STRUCTURE_TYPE_OPTIONAL_INSTANCE_EXTENSIONS_INFO;
+    optional_extensions_info.extensions = optional_instance_extensions;
+    optional_extensions_info.extension_count = ARRAY_SIZE(optional_instance_extensions);
+
     memset(&instance_create_info, 0, sizeof(instance_create_info));
     instance_create_info.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
-    instance_create_info.next = NULL;
+    instance_create_info.next = &optional_extensions_info;
     instance_create_info.pfn_signal_event = vkd3d_signal_event;
     instance_create_info.wchar_size = sizeof(WCHAR);
     instance_create_info.instance_extensions = instance_extensions;
diff --git a/libs/vkd3d-utils/vkd3d_utils_private.h b/libs/vkd3d-utils/vkd3d_utils_private.h
index b4828cc3ed5c..a31f9b737e3f 100644
--- a/libs/vkd3d-utils/vkd3d_utils_private.h
+++ b/libs/vkd3d-utils/vkd3d_utils_private.h
@@ -21,13 +21,10 @@
 
 #define COBJMACROS
 #define NONAMELESSUNION
-#include "vkd3d_memory.h"
-#include "vkd3d_utils.h"
-
 #define VK_NO_PROTOTYPES
-#ifdef HAVE_XCB
-# define VK_USE_PLATFORM_XCB_KHR
-#endif
+
+#include "vkd3d_memory.h"
+#include <vkd3d_utils.h>
 
 #include <pthread.h>
 #include <vkd3d.h>
-- 
2.16.4




More information about the wine-devel mailing list