DirectDraw over Direct3D

Roderick Colenbrander thunderbird2k at
Sun Dec 4 14:44:31 CST 2005


As you all might know 2d games tend to be slow on Wine. For a lot of games the 
main bottleneck is depth conversion which happens in cases when the depth 
requested by the game and the X desktop color are not the same.

As a way to speedup 2d Lionel assisted me with hacking wine's ddraw to let it 
use parts of the Direct3D backend. The final rendering is then done using 
OpenGL and the end result is that the videocard does the color conversion for 
us. The patch greatly improves the performance of 2d games which don't use 
GetDC/ReleaseDC a lot.

While the patch fixes the conversion bottleneck for various games it doesn't 
handle 8bit paletted which is used by games like StarCraft as OpenGL doesn't 
support this by default. The second patch which I attached aswell adds 
support for this. On cards (atleast all nvidia cards from geforce 1 to the 
fx) that support the opengl paletted texture extension this extension is 
used. It makes StarCraft very fast atleast on my Athlon XP2000 system with a 
GeforceFX where the game was slow before. As not all cards support paletted 
textures I emulated this using a simple fragment shader. (a 1D texture 
containing the palette is used as a loopup table)

The attached patches are still experimental and likely contain bugs so please 
test them. When the patches are applied set 
'HKCU\Software\Wine\DirectDraw\UseDDrawOverD3D' to Y else it won't do 
anything :)

Further note that lots of games like to use multiple threads for graphics... 
using the patch games use 'd3d' (or actually opengl) which adds more 
multithreaded d3d games :) Games like command&conquer, redalert, total 
annihilation and lots of others became multithreaded. (they crash quite 
quickly due to some critical section in x11drv)

All have fun with the patches and please report any issues that appear so that 
i can fix the patches and submit them to wine-patches,

Roderick Colenbrander

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ddraw_over_d3d.patch
Type: text/x-diff
Size: 17140 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paletted_texture.patch
Type: text/x-diff
Size: 9319 bytes
Desc: not available
Url :

More information about the wine-devel mailing list