Signed-off-by: Józef Kucia jkucia@codeweavers.com --- configure.ac | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/configure.ac b/configure.ac index 312c235bb1df..e088643aad0a 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,7 @@ AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl],[do not use SDL])) AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF])) AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)])) AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)])) +AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) @@ -1855,6 +1856,26 @@ fi WINE_NOTICE_WITH(vulkan,[test "x$ac_cv_lib_soname_vulkan" = "x"], [libvulkan ${notice_platform}development files not found, Vulkan won't be supported.])
+dnl **** Check for vkd3d **** +if test "x$with_vkd3d" != "xno" +then + WINE_PACKAGE_FLAGS(VKD3D,[libvkd3d],,,,) + + if test "x$VKD3D_LIBS" = "x" + then + VKD3D_CFLAGS="" + VKD3D_LIBS="" + else + WINE_CHECK_SONAME(vkd3d,vkd3d_create_device,,,[$VKD3D_LIBS]) + fi +fi + +if test "x$ac_cv_lib_soname_vkd3d" = "x" +then + WINE_NOTICE([vkd3d ${notice_platform}development files not found, Direct3D 12 won't be supported.]) + enable_d3d12=${enable_d3d12:-no} +fi + dnl **** Check for gcc specific options ****
AC_SUBST(EXTRACFLAGS,"")
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d12/Makefile.in | 2 ++ dlls/d3d12/d3d12.spec | 2 +- dlls/d3d12/d3d12_main.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d12/Makefile.in b/dlls/d3d12/Makefile.in index d7ee1b59a221..458f3e202da6 100644 --- a/dlls/d3d12/Makefile.in +++ b/dlls/d3d12/Makefile.in @@ -1,5 +1,7 @@ MODULE = d3d12.dll IMPORTLIB = d3d12 +EXTRALIBS = $(VKD3D_LIBS) +EXTRAINCL = $(VKD3D_CFLAGS)
C_SRCS = \ d3d12_main.c diff --git a/dlls/d3d12/d3d12.spec b/dlls/d3d12/d3d12.spec index 613092bc88a0..b60799346e56 100644 --- a/dlls/d3d12/d3d12.spec +++ b/dlls/d3d12/d3d12.spec @@ -4,5 +4,5 @@ 103 stub D3D12CoreCreateLayeredDevice 104 stub D3D12CoreGetLayeredDeviceSize 105 stub D3D12CoreRegisterLayers -106 stub D3D12CreateRootSignatureDeserializer +106 stdcall D3D12CreateRootSignatureDeserializer(ptr long ptr ptr) 107 stub D3D12SerializeRootSignature diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c index c1598ca2a1a5..b810dd5812a8 100644 --- a/dlls/d3d12/d3d12_main.c +++ b/dlls/d3d12/d3d12_main.c @@ -20,9 +20,18 @@ #include "config.h" #include "wine/port.h"
+#define VK_NO_PROTOTYPES +#define VKD3D_NO_VULKAN_H +#define VKD3D_NO_WIN32_TYPES +#define WINE_VK_ALIGN(x) + #include "wine/debug.h" +#include "wine/vulkan.h" + #include "d3d12.h"
+#include <vkd3d.h> + WINE_DEFAULT_DEBUG_CHANNEL(d3d12);
HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug) @@ -40,3 +49,12 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe
return E_NOTIMPL; } + +HRESULT WINAPI D3D12CreateRootSignatureDeserializer(const void *data, SIZE_T data_size, + REFIID iid, void **deserializer) +{ + TRACE("data %p, data_size %lu, iid %s, deserializer %p.\n", + data, data_size, debugstr_guid(iid), deserializer); + + return vkd3d_create_root_signature_deserializer(data, data_size, iid, deserializer); +}
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d12/d3d12.spec | 2 +- dlls/d3d12/d3d12_main.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d12/d3d12.spec b/dlls/d3d12/d3d12.spec index b60799346e56..53151bf154e0 100644 --- a/dlls/d3d12/d3d12.spec +++ b/dlls/d3d12/d3d12.spec @@ -5,4 +5,4 @@ 104 stub D3D12CoreGetLayeredDeviceSize 105 stub D3D12CoreRegisterLayers 106 stdcall D3D12CreateRootSignatureDeserializer(ptr long ptr ptr) -107 stub D3D12SerializeRootSignature +107 stdcall D3D12SerializeRootSignature(ptr long ptr ptr) diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c index b810dd5812a8..bb17cbcd2dbe 100644 --- a/dlls/d3d12/d3d12_main.c +++ b/dlls/d3d12/d3d12_main.c @@ -58,3 +58,12 @@ HRESULT WINAPI D3D12CreateRootSignatureDeserializer(const void *data, SIZE_T dat
return vkd3d_create_root_signature_deserializer(data, data_size, iid, deserializer); } + +HRESULT WINAPI D3D12SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC *root_signature_desc, + D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob) +{ + TRACE("root_signature_desc %p, version %#x, blob %p, error_blob %p.\n", + root_signature_desc, version, blob, error_blob); + + return vkd3d_serialize_root_signature(root_signature_desc, version, blob, error_blob); +}
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Adds initial "headless" support for D3D12 (no DXGI).
--- dlls/d3d12/Makefile.in | 1 + dlls/d3d12/d3d12_main.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d12/Makefile.in b/dlls/d3d12/Makefile.in index 458f3e202da6..62fb01a21270 100644 --- a/dlls/d3d12/Makefile.in +++ b/dlls/d3d12/Makefile.in @@ -1,5 +1,6 @@ MODULE = d3d12.dll IMPORTLIB = d3d12 +IMPORTS = gdi32 user32 EXTRALIBS = $(VKD3D_LIBS) EXTRAINCL = $(VKD3D_CFLAGS)
diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c index bb17cbcd2dbe..c1dc8c835263 100644 --- a/dlls/d3d12/d3d12_main.c +++ b/dlls/d3d12/d3d12_main.c @@ -26,7 +26,9 @@ #define WINE_VK_ALIGN(x)
#include "wine/debug.h" +#include "wine/heap.h" #include "wine/vulkan.h" +#include "wine/vulkan_driver.h"
#include "d3d12.h"
@@ -41,13 +43,101 @@ HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug) return E_NOTIMPL; }
+static HRESULT d3d12_signal_event(HANDLE event) +{ + return SetEvent(event) ? S_OK : E_FAIL; +} + +struct d3d12_thread_data +{ + PFN_vkd3d_thread main_pfn; + void *data; +}; + +static DWORD WINAPI d3d12_thread_main(void *data) +{ + struct d3d12_thread_data *thread_data = data; + + thread_data->main_pfn(thread_data->data); + heap_free(thread_data); + return 0; +} + +static void *d3d12_create_thread(PFN_vkd3d_thread main_pfn, void *data) +{ + struct d3d12_thread_data *thread_data; + HANDLE thread; + + if (!(thread_data = heap_alloc(sizeof(*thread_data)))) + { + ERR("Failed to allocate thread data.\n"); + return NULL; + } + + thread_data->main_pfn = main_pfn; + thread_data->data = data; + + if (!(thread = CreateThread(NULL, 0, d3d12_thread_main, thread_data, 0, NULL))) + heap_free(thread_data); + + return thread; +} + +static HRESULT d3d12_join_thread(void *handle) +{ + HANDLE thread = handle; + DWORD ret; + + if ((ret = WaitForSingleObject(thread, INFINITE)) != WAIT_OBJECT_0) + ERR("Failed to wait for thread, ret %#x.\n", ret); + CloseHandle(thread); + return ret == WAIT_OBJECT_0 ? S_OK : E_FAIL; +} + +static const struct vulkan_funcs *get_vk_funcs(void) +{ + const struct vulkan_funcs *vk_funcs; + HDC hdc; + + hdc = GetDC(0); + vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION); + ReleaseDC(0, hdc); + return vk_funcs; +} + HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_feature_level, REFIID iid, void **device) { - FIXME("adapter %p, minimum_feature_level %#x, iid %s, device %p stub!\n", + struct vkd3d_instance_create_info instance_create_info; + struct vkd3d_device_create_info device_create_info; + const struct vulkan_funcs *vk_funcs; + + TRACE("adapter %p, minimum_feature_level %#x, iid %s, device %p.\n", adapter, minimum_feature_level, debugstr_guid(iid), device);
- return E_NOTIMPL; + if (!(vk_funcs = get_vk_funcs())) + { + ERR("Failed to get Wine Vulkan driver.\n"); + return E_FAIL; + } + + FIXME("Ignoring adapter %p.\n", adapter); + + memset(&instance_create_info, 0, sizeof(instance_create_info)); + instance_create_info.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + instance_create_info.pfn_signal_event = d3d12_signal_event; + instance_create_info.pfn_create_thread = d3d12_create_thread; + instance_create_info.pfn_join_thread = d3d12_join_thread; + instance_create_info.wchar_size = sizeof(WCHAR); + instance_create_info.pfn_vkGetInstanceProcAddr + = (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr; + + memset(&device_create_info, 0, sizeof(device_create_info)); + device_create_info.type = VKD3D_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + device_create_info.minimum_feature_level = minimum_feature_level; + device_create_info.instance_create_info = &instance_create_info; + + return vkd3d_create_device(&device_create_info, iid, device); }
HRESULT WINAPI D3D12CreateRootSignatureDeserializer(const void *data, SIZE_T data_size,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com