[5/5] WineD3D: Implement buffer subrange mapping with GL_APPLE_flush_buffer_range

Henri Verbeet hverbeet at gmail.com
Wed Dec 16 06:44:06 CST 2009

2009/12/16 Stefan Dösinger <stefan at codeweavers.com>:
> The best way I see to merge those two tracking mechanisms is to organize them as a list, and upload all modified ranges in PreLoad(), or if the buffer is single buffered and dynamic, flush all the ranges after the last unmap, and clear the list in both PreLoad and unmap. That way we can share the data structure, although it doesn't perfectly fit either purpose. We can also share some of the code. The downside is that GL doesn't start flushing until the final unmap on dynamic buffers.
A list should work, but it doesn't have to be a single list. You can
keep a list for the map stack (you can also store it as an array of
pointers to the ranges, not sure if that gains you anything though),
an on unmap you either free the range (or put it in a free list or
device range pool,  whatever) or transfer it to the list you keep for
PreLoad(). You can also potentially merge and/or sort the second list.
As a first step you could always merge the second list into a single
entry, and end up with something that behaves pretty much like the
current code.

More information about the wine-devel mailing list