libs/vkd3d: Implement d3d12_device_GetAdapterLuid().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-23 13:30:16 +01:00 committed by Alexandre Julliard
parent c9c6caae98
commit 4cd36fc553
5 changed files with 43 additions and 10 deletions

View File

@ -65,6 +65,8 @@ struct vkd3d_device_create_info
const struct vkd3d_instance_create_info *instance_create_info;
VkPhysicalDevice vk_physical_device;
LUID adapter_luid;
};
/* resource flags */

View File

@ -2052,7 +2052,11 @@ static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling(ID3D12Device *iface
static LUID * STDMETHODCALLTYPE d3d12_device_GetAdapterLuid(ID3D12Device *iface, LUID *luid)
{
FIXME("iface %p, luid %p stub!\n", iface, luid);
struct d3d12_device *device = impl_from_ID3D12Device(iface);
TRACE("iface %p, luid %p.\n", iface, luid);
*luid = device->adapter_luid;
return luid;
}
@ -2117,7 +2121,7 @@ struct d3d12_device *unsafe_impl_from_ID3D12Device(ID3D12Device *iface)
}
static HRESULT d3d12_device_init(struct d3d12_device *device,
struct vkd3d_instance *instance, VkPhysicalDevice vk_physical_device)
struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info)
{
HRESULT hr;
@ -2131,7 +2135,9 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
device->join_thread = instance->join_thread;
device->wchar_size = instance->wchar_size;
if (FAILED(hr = vkd3d_create_vk_device(device, vk_physical_device)))
device->adapter_luid = create_info->adapter_luid;
if (FAILED(hr = vkd3d_create_vk_device(device, create_info->vk_physical_device)))
{
vkd3d_instance_decref(device->vkd3d_instance);
return hr;
@ -2163,7 +2169,7 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
}
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
VkPhysicalDevice vk_physical_device, struct d3d12_device **device)
const struct vkd3d_device_create_info *create_info, struct d3d12_device **device)
{
struct d3d12_device *object;
HRESULT hr;
@ -2171,7 +2177,7 @@ HRESULT d3d12_device_create(struct vkd3d_instance *instance,
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d12_device_init(object, instance, vk_physical_device)))
if (FAILED(hr = d3d12_device_init(object, instance, create_info)))
{
vkd3d_free(object);
return hr;

View File

@ -20,13 +20,13 @@
#include "vkd3d_private.h"
HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
REFIID riid, void **device)
REFIID iid, void **device)
{
struct vkd3d_instance *instance;
struct d3d12_device *object;
HRESULT hr;
TRACE("create_info %p, riid %s, device %p.\n", create_info, debugstr_guid(riid), device);
TRACE("create_info %p, iid %s, device %p.\n", create_info, debugstr_guid(iid), device);
if (!create_info || !device)
return E_INVALIDARG;
@ -64,13 +64,13 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
return E_FAIL;
}
hr = d3d12_device_create(instance, create_info->vk_physical_device, &object);
hr = d3d12_device_create(instance, create_info, &object);
vkd3d_instance_decref(instance);
if (FAILED(hr))
return hr;
return return_interface((IUnknown *)&object->ID3D12Device_iface, &IID_ID3D12Device,
riid, device);
iid, device);
}
/* ID3D12RootSignatureDeserializer */

View File

@ -665,10 +665,12 @@ struct d3d12_device
vkd3d_create_thread_pfn create_thread;
vkd3d_join_thread_pfn join_thread;
LUID adapter_luid;
};
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
VkPhysicalDevice vk_physical_device, struct d3d12_device **device) DECLSPEC_HIDDEN;
const struct vkd3d_device_create_info *create_info, struct d3d12_device **device) DECLSPEC_HIDDEN;
struct d3d12_device *unsafe_impl_from_ID3D12Device(ID3D12Device *iface) DECLSPEC_HIDDEN;
HRESULT vkd3d_create_buffer(struct d3d12_device *device,

View File

@ -299,6 +299,28 @@ static void test_physical_device(void)
ok(!refcount, "Instance has %u references left.\n", refcount);
}
static void test_adapter_luid(void)
{
struct vkd3d_device_create_info create_info;
ID3D12Device *device;
ULONG refcount;
HRESULT hr;
LUID luid;
create_info = device_default_create_info;
create_info.adapter_luid.HighPart = 0xdeadc0de;
create_info.adapter_luid.LowPart = 0xdeadbeef;
hr = vkd3d_create_device(&create_info, &IID_ID3D12Device, (void **)&device);
ok(hr == S_OK, "Failed to create device, hr %#x.\n", hr);
luid = ID3D12Device_GetAdapterLuid(device);
ok(luid.HighPart == 0xdeadc0de && luid.LowPart == 0xdeadbeef,
"Got unexpected LUID %08x:%08x.\n", luid.HighPart, luid.LowPart);
refcount = ID3D12Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
}
static void test_vkd3d_queue(void)
{
ID3D12CommandQueue *direct_queue, *compute_queue, *copy_queue;
@ -362,5 +384,6 @@ START_TEST(vkd3d_api)
run_test(test_create_device);
run_test(test_required_device_extensions);
run_test(test_physical_device);
run_test(test_adapter_luid);
run_test(test_vkd3d_queue);
}