d3d12: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-03-03 10:16:01 +01:00
parent 5d62e5603a
commit b53d4dacca
2 changed files with 10 additions and 90 deletions

View File

@ -1,11 +1,8 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = d3d12.dll MODULE = d3d12.dll
IMPORTLIB = d3d12 IMPORTLIB = d3d12
IMPORTS = dxgi dxguid gdi32 user32 uuid win32u IMPORTS = dxgi dxguid wined3d gdi32 user32 uuid win32u
EXTRALIBS = $(VKD3D_LIBS) EXTRAINCL = $(VKD3D_PE_CFLAGS)
EXTRAINCL = $(VKD3D_CFLAGS)
EXTRADLLFLAGS = -mcygwin
C_SRCS = \ C_SRCS = \
d3d12_main.c d3d12_main.c

View File

@ -17,35 +17,19 @@
* *
*/ */
#include "config.h"
#define COBJMACROS #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 <vkd3d.h>
#include "dxgi1_6.h"
#include "initguid.h" #include "initguid.h"
#include "wine/wined3d.h" #include "wine/wined3d.h"
#include "wine/winedxgi.h" #include "wine/winedxgi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d12); WINE_DEFAULT_DEBUG_CHANNEL(d3d12);
WINE_DECLARE_DEBUG_CHANNEL(winediag); WINE_DECLARE_DEBUG_CHANNEL(winediag);
#ifdef USE_WIN32_VULKAN
static HMODULE vulkan_module; static HMODULE vulkan_module;
/* FIXME: We should unload vulkan-1.dll. */ /* FIXME: We should unload vulkan-1.dll. */
@ -67,21 +51,6 @@ static PFN_vkGetInstanceProcAddr load_vulkan(void)
return NULL; 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) HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug)
{ {
TRACE("iid %s, debug %p.\n", debugstr_guid(iid), 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; 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) static HRESULT d3d12_get_adapter(IWineDXGIAdapter **wine_adapter, IUnknown *adapter)
{ {
IDXGIAdapter *dxgi_adapter = NULL; IDXGIAdapter *dxgi_adapter = NULL;
@ -200,7 +123,7 @@ static BOOL check_vk_instance_extension(VkInstance vk_instance,
if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) < 0) if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, NULL) < 0)
return FALSE; return FALSE;
if (!(properties = heap_calloc(count, sizeof(*properties)))) if (!(properties = calloc(count, sizeof(*properties))))
return FALSE; return FALSE;
if (pfn_vkEnumerateInstanceExtensionProperties(NULL, &count, properties) >= 0) 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; return ret;
} }
@ -254,7 +177,7 @@ static VkPhysicalDevice d3d12_get_vk_physical_device(struct vkd3d_instance *inst
return VK_NULL_HANDLE; 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; return VK_NULL_HANDLE;
if ((vr = pfn_vkEnumeratePhysicalDevices(vk_instance, &count, vk_physical_devices)) < 0) 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"); FIXME("Could not find Vulkan physical device for DXGI adapter.\n");
done: done:
heap_free(vk_physical_devices); free(vk_physical_devices);
return vk_physical_device; 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.type = VKD3D_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_create_info.next = &optional_extensions_info; instance_create_info.next = &optional_extensions_info;
instance_create_info.pfn_signal_event = d3d12_signal_event; instance_create_info.pfn_signal_event = d3d12_signal_event;
instance_create_info.pfn_create_thread = d3d12_create_thread; instance_create_info.pfn_create_thread = NULL;
instance_create_info.pfn_join_thread = d3d12_join_thread; instance_create_info.pfn_join_thread = NULL;
instance_create_info.wchar_size = sizeof(WCHAR); instance_create_info.wchar_size = sizeof(WCHAR);
instance_create_info.pfn_vkGetInstanceProcAddr = pfn_vkGetInstanceProcAddr; instance_create_info.pfn_vkGetInstanceProcAddr = pfn_vkGetInstanceProcAddr;
instance_create_info.instance_extensions = instance_extensions; instance_create_info.instance_extensions = instance_extensions;