Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/wined3d/adapter_vk.c | 2 ++ dlls/wined3d/directx.c | 4 ++++ 2 files changed, 6 insertions(+)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index f648dd196f7..b122982bc13 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2198,6 +2198,8 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk,
memcpy(&adapter->driver_uuid, id_properties.driverUUID, sizeof(adapter->driver_uuid)); memcpy(&adapter->device_uuid, id_properties.deviceUUID, sizeof(adapter->device_uuid)); + if (id_properties.deviceLUIDValid) + memcpy(&adapter->luid, id_properties.deviceLUID, sizeof(adapter->luid));
if (!wined3d_adapter_vk_init_format_info(adapter_vk, vk_info)) goto fail; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index a9a5a3aac36..fd618303e1e 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2965,6 +2965,10 @@ static BOOL wined3d_adapter_init_luid(struct wined3d_adapter *adapter) D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_param; D3DKMT_CLOSEADAPTER close_adapter_param;
+ /* Already initialised */ + if (adapter->luid.LowPart || adapter->luid.HighPart) + return TRUE; + if (!get_primary_display(open_adapter_param.DeviceName)) return FALSE;
On Mon, 6 Jul 2020 at 13:06, Zhiyi Zhang zzhang@codeweavers.com wrote:
@@ -2965,6 +2965,10 @@ static BOOL wined3d_adapter_init_luid(struct wined3d_adapter *adapter) D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_param; D3DKMT_CLOSEADAPTER close_adapter_param;
- /* Already initialised */
- if (adapter->luid.LowPart || adapter->luid.HighPart)
return TRUE;
This seems somewhat fragile. The assumption in most *_init() functions is that the structure it's operating on is zero-initialised, or in rare cases uninitialised. If wined3d_adapter_init() needs to use a LUID retrieved by its caller, it seems best to explicitly pass it as a function argument. (Or NULL if we don't have one.) In principle another option may be to not initialise the LUID in wined3d_adapter_init() at all, and just call wined3d_adapter_init_luid() from its callers, but I imagine that won't work for assigning outputs.
Similar concerns apply to calling e.g. adapter_vk_init_driver_info() before wined3d_adapter_init() in patch 2/3.