[2/5] WineD3D: Add an internal event query finish function

Stefan Dösinger stefandoesinger at gmx.at
Tue Feb 16 07:59:12 CST 2010

Okay, here's another proposal, this time based on a new wined3d_event_query interface. There are two event query interfaces now, wined3d_event_query and IWineD3DEventQuery. The former does pretty much all the work, the latter is just a COM wrapper. The only functionality added by IWineD3DEventQuery is the event query faking if we have no GL extension available(It is handled in wined3d_event_query temporarily to aid the transition. Patch 3 moves it into its final place).

A difference to your original proposal is that wined3d_event_query always takes care of activating the context. It will also take care of remembering which queries are finished to improve some multithreading cases and avoid issues if the driver doesn't like a query to be finished twice.

On the buffer side things are essentially unchanged, except that I removed the check if queries are supported. As long as the app never requests synchronization we can do just fine without event query support, and if the app wants synchronization we can fall back later anyway.

> You certainly need to flush, but that's not the point. Using
> GL_SYNC_FLUSH_COMMANDS is either unnecessary if you already flush
> after glFenceSync(), or doesn't solve the problem for fences in
> different contexts if you don't. Note that the existing code doesn't
> have to flush after glFenceSync() because we use a 0 timeout in
> GetData().
The existing code has to honor D3DGETDATA_FLUSH if the app passes it. The 0 timeout doesn't help us if the app does something like this

BOOL data;
    IWineD3DQuery_GetData(event_query, D3DGETDATA_FLUSH, &data);
} while(!data);

in a single threaded environment.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patches2.zip
Type: application/zip
Size: 14400 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20100216/cceb4c47/attachment-0001.zip>
-------------- next part --------------

More information about the wine-devel mailing list