Alexandre Julliard : d3d12: Build with msvcrt.

Alexandre Julliard julliard at winehq.org
Thu Mar 3 16:06:40 CST 2022


Module: wine
Branch: master
Commit: b53d4dacca3badd10b2fd7c01d33f81f624c1b45
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b53d4dacca3badd10b2fd7c01d33f81f624c1b45

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Mar  3 10:16:01 2022 +0100

d3d12: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d12/Makefile.in  |  7 ++--
 dlls/d3d12/d3d12_main.c | 93 +++++--------------------------------------------
 2 files changed, 10 insertions(+), 90 deletions(-)

diff --git a/dlls/d3d12/Makefile.in b/dlls/d3d12/Makefile.in
index 50f292c0c9b..e5fb77be025 100644
--- a/dlls/d3d12/Makefile.in
+++ b/dlls/d3d12/Makefile.in
@@ -1,11 +1,8 @@
 EXTRADEFS = -DWINE_NO_LONG_TYPES
 MODULE    = d3d12.dll
 IMPORTLIB = d3d12
-IMPORTS   = dxgi dxguid gdi32 user32 uuid win32u
-EXTRALIBS = $(VKD3D_LIBS)
-EXTRAINCL = $(VKD3D_CFLAGS)
-
-EXTRADLLFLAGS = -mcygwin
+IMPORTS   = dxgi dxguid wined3d gdi32 user32 uuid win32u
+EXTRAINCL = $(VKD3D_PE_CFLAGS)
 
 C_SRCS = \
 	d3d12_main.c
diff --git a/dlls/d3d12/d3d12_main.c b/dlls/d3d12/d3d12_main.c
index f7f05b42123..1c2cea6a6f3 100644
--- a/dlls/d3d12/d3d12_main.c
+++ b/dlls/d3d12/d3d12_main.c
@@ -17,35 +17,19 @@
  *
  */
 
-#include "config.h"
-
 #define COBJMACROS
-#define VK_NO_PROTOTYPES
-#define VKD3D_NO_VULKAN_H
-#define VKD3D_NO_WIN32_TYPES
-#ifndef USE_WIN32_VULKAN
-#define WINE_VK_HOST
-#endif
-
-#include "wine/debug.h"
-#include "wine/heap.h"
-#include "wine/vulkan.h"
-#include "wine/vulkan_driver.h"
-
-#include "dxgi1_6.h"
-#include "d3d12.h"
 
 #include <vkd3d.h>
+#include "dxgi1_6.h"
 
 #include "initguid.h"
 #include "wine/wined3d.h"
 #include "wine/winedxgi.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d12);
 WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
-#ifdef USE_WIN32_VULKAN
-
 static HMODULE vulkan_module;
 
 /* FIXME: We should unload vulkan-1.dll. */
@@ -67,21 +51,6 @@ static PFN_vkGetInstanceProcAddr load_vulkan(void)
     return NULL;
 }
 
-#else
-
-static PFN_vkGetInstanceProcAddr load_vulkan(void)
-{
-    const struct vulkan_funcs *vk_funcs;
-
-    vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
-    if (vk_funcs)
-        return (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr;
-
-    return NULL;
-}
-
-#endif  /* USE_WIN32_VULKAN */
-
 HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug)
 {
     TRACE("iid %s, debug %p.\n", debugstr_guid(iid), debug);
@@ -104,52 +73,6 @@ 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 HRESULT d3d12_get_adapter(IWineDXGIAdapter **wine_adapter, IUnknown *adapter)
 {
     IDXGIAdapter *dxgi_adapter = NULL;
@@ -200,7 +123,7 @@ static BOOL check_vk_instance_extension(VkInstance vk_instance,
     if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) < 0)
         return FALSE;
 
-    if (!(properties = heap_calloc(count, sizeof(*properties))))
+    if (!(properties = calloc(count, sizeof(*properties))))
         return FALSE;
 
     if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, properties) >= 0)
@@ -215,7 +138,7 @@ static BOOL check_vk_instance_extension(VkInstance vk_instance,
         }
     }
 
-    heap_free(properties);
+    free(properties);
     return ret;
 }
 
@@ -254,7 +177,7 @@ static VkPhysicalDevice d3d12_get_vk_physical_device(struct vkd3d_instance *inst
         return VK_NULL_HANDLE;
     }
 
-    if (!(vk_physical_devices = heap_calloc(count, sizeof(*vk_physical_devices))))
+    if (!(vk_physical_devices = calloc(count, sizeof(*vk_physical_devices))))
         return VK_NULL_HANDLE;
 
     if ((vr = pfn_vkEnumeratePhysicalDevices(vk_instance, &count, vk_physical_devices)) < 0)
@@ -305,7 +228,7 @@ static VkPhysicalDevice d3d12_get_vk_physical_device(struct vkd3d_instance *inst
         FIXME("Could not find Vulkan physical device for DXGI adapter.\n");
 
 done:
-    heap_free(vk_physical_devices);
+    free(vk_physical_devices);
     return vk_physical_device;
 }
 
@@ -367,8 +290,8 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, D3D_FEATURE_LEVEL minimum_fe
     instance_create_info.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
     instance_create_info.next = &optional_extensions_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.pfn_create_thread = NULL;
+    instance_create_info.pfn_join_thread = NULL;
     instance_create_info.wchar_size = sizeof(WCHAR);
     instance_create_info.pfn_vkGetInstanceProcAddr = pfn_vkGetInstanceProcAddr;
     instance_create_info.instance_extensions = instance_extensions;




More information about the wine-cvs mailing list