[1] WineD3D: Add the state dirtification infrastructure

Stefan Dösinger stefan at codeweavers.com
Fri Dec 15 15:43:10 CST 2006

Am Freitag 15 Dezember 2006 18:31 schrieb Stefan Dösinger:
> This patch adds the dirty list infrastructure. A dirty marker consists of a
> DWORD containing the state it marks dirty, and the list structure to build
> the list.
> The wined3ddevice has 3 new members:
> dirtyStateList: The list of dirty states. This will be moved to a
> per-context stucture once we add multithreading support
> freeListElems: A list containing unused dirty markers to avoid unnecessary
> HeapAlloc/HeapFree calls. I have seen D3D games spending 15% cpu time in
> the Heap code, we don't want to increase that.
> dirtyStates: An array that tells if a state is dirty. It is used to avoid
> double dirtification. I do not use the stateblock->changed.XXXX[] array
> because this is used for different purposes in the stateblock code. Ivan,
> do we still need it?
Vitaly asked me on irc why I use a linked list instead of an array or bitmap. 
Well, my original plan was indeed an array, but after discussing it with 
Henri I decided to got for a list. See 
http://www.winehq.org/pipermail/wine-devel/2006-October/051868.html and 
following posts.

The main arguments for a list were:

* The shader constant code uses it too. It keeps the code somewhat simmilar
* memory usage. An array has a fixed sizeof(DWORD) * STATE_HIGHEST mem usage, 
while a list has sizeof(DWORD) + 2*sizeof(void *) * number of dirty states 
memory usage. well, that was the idea

In fact, the initial dirtification kills the memory usage argument. However, 
instead of dirtifying all the elements I could set the recording flag in the 
device on before initializing the initial stateblock and later apply the 
states instead of dirtifying them. When there are multiple contexts those can 
share the list of the free dirty markers.

The way dirtification is done and the rest of the code are independent from 
each other, so it can be changed easilly when we decide to do so. I prefer to 
get the state management running first, and then move the initial opengl 
setup to Init3D().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061215/d2af91eb/attachment.pgp

More information about the wine-devel mailing list