On 2 August 2018 at 21:23, Chip Davis cdavis@codeweavers.com wrote:
Both demo programs run flawlessly. Unfortunately, the d3d12 test is broken, due to Metal getting an invalid pixel format. This needs investigation and perhaps fixing on the MoltenVK side.
Signed-off-by: Chip Davis cdavis@codeweavers.com
Makefile.am | 6 +- configure.ac | 21 +- demos/demo.h | 4 + demos/demo_mvk.h | 666 +++++++++++++++++++++++++ libs/vkd3d-utils/vkd3d_utils_main.c | 4 + libs/vkd3d-utils/vkd3d_utils_private.h | 5 + libs/vkd3d/device.c | 10 +- tests/vkd3d_api.c | 16 + 8 files changed, 727 insertions(+), 5 deletions(-) create mode 100644 demos/demo_mvk.h
Objective-C is a blocker, I'm afraid. But, regardless:
diff --git a/demos/demo.h b/demos/demo.h index 2869ea7..de8eae0 100644 --- a/demos/demo.h +++ b/demos/demo.h @@ -143,5 +143,9 @@ static inline HRESULT demo_create_root_signature(ID3D12Device *device, #else #include <vkd3d_utils.h> #define INFINITE VKD3D_INFINITE +#ifdef __APPLE__ +#include "demo_mvk.h" +#else #include "demo_xcb.h" #endif +#endif
This should check for XCB/MoltenVK, rather than for Apple.
diff --git a/libs/vkd3d-utils/vkd3d_utils_private.h b/libs/vkd3d-utils/vkd3d_utils_private.h index 6aa0df6..a59f471 100644 --- a/libs/vkd3d-utils/vkd3d_utils_private.h +++ b/libs/vkd3d-utils/vkd3d_utils_private.h @@ -20,7 +20,12 @@ #define __VKD3D_UTILS_PRIVATE_H
#define VK_NO_PROTOTYPES
+#ifdef __APPLE__ +#define VK_USE_PLATFORM_MACOS_MVK +#else #define VK_USE_PLATFORM_XCB_KHR +#endif
Likewise.
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 6fa0017..0052eba 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -205,6 +205,12 @@ static HRESULT vkd3d_init_instance_caps(struct vkd3d_instance *instance, return S_OK; }
+#ifdef HAVE_MOLTENVK_VK_MVK_MOLTENVK_H +#define VULKAN_SO_NAME "libMoltenVK.dylib" +#else +#define VULKAN_SO_NAME "libvulkan.so.1" +#endif
That belongs in configure.
diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c index e2d9d01..3980b4e 100644 --- a/tests/vkd3d_api.c +++ b/tests/vkd3d_api.c @@ -19,8 +19,12 @@ #define COBJMACROS #define INITGUID #define WIDL_C_INLINE_WRAPPERS +#ifdef __APPLE__ +#define VK_USE_PLATFORM_MACOS_MVK +#else #define VK_USE_PLATFORM_XCB_KHR #define VK_USE_PLATFORM_XLIB_KHR +#endif #include "vkd3d_test.h" #include <vkd3d.h>
@@ -215,8 +219,12 @@ static void test_additional_instance_extensions(void) struct vulkan_extension extensions[] = { {VK_KHR_SURFACE_EXTENSION_NAME}, +#ifdef __APPLE__
{VK_MVK_MACOS_SURFACE_EXTENSION_NAME},
+#else {VK_KHR_XCB_SURFACE_EXTENSION_NAME}, {VK_KHR_XLIB_SURFACE_EXTENSION_NAME}, +#endif };
const char *enabled_extensions[ARRAY_SIZE(extensions)];
@@ -249,6 +257,13 @@ static void test_additional_instance_extensions(void) if (!extensions[i].is_supported) continue;
+#ifdef __APPLE__
if (!strcmp(extensions[i].name, VK_MVK_MACOS_SURFACE_EXTENSION_NAME))
{
pfn = vkGetInstanceProcAddr(vk_instance, "vkCreateMacOSSurfaceMVK");
ok(pfn, "Failed to get proc addr for vkCreateMacOSSurfaceMVK.\n");
}
+#else if (!strcmp(extensions[i].name, VK_KHR_XCB_SURFACE_EXTENSION_NAME)) { pfn = vkGetInstanceProcAddr(vk_instance, "vkCreateXcbSurfaceKHR"); @@ -259,6 +274,7 @@ static void test_additional_instance_extensions(void) pfn = vkGetInstanceProcAddr(vk_instance, "vkCreateXlibSurfaceKHR"); ok(pfn, "Failed to get proc addr for vkCreateXlibSurfaceKHR.\n"); } +#endif
More "#ifdef __APPLE__" that should be checking for MoltenVK instead.