On 16 Aug 2022, at 07:10, Henri Verbeet (@hverbeet) wine@gitlab.winehq.org wrote:
From patch 2/2:
@@ -3832,10 +3833,17 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface) return DDERR_WRONGMODE; surface->is_lost = FALSE; + for(i = 0; i < MAX_COMPLEX_ATTACHED; i++) { - if (surface->complex_array[i]) - surface->complex_array[i]->is_lost = FALSE; + attachment = surface->complex_array[i]; + while (attachment) + { + attachment->is_lost = FALSE; + attachment = attachment->complex_array[0]; + if (attachment == surface->complex_array[i]) + break; + } } return DD_OK;
Does that do the right thing? I don't think that iterates over any surfaces it previously didn't. I'd expect an `attachment = attachment->next_attached` somewhere in there.
I think it does iterates over more surfaces with this change, in particular, more than one flippable surface.
Multiple backbuffers and mip levels form a chain through complex_array[0] (with other complex array elements used by head cube texture surface only). Without the change only the first after head was restored.
The surfaces attached explicitly by the app go to next_attached.
My test adds todo_wine which is removed with the change. I also added a test with attached Z buffer which suggests we should not iterate over next_attached, at least not in a generic case.