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.