Compositing GL

Chris Robinson chris.kcat at gmail.com
Tue Aug 21 20:36:05 CDT 2007


Over the past several days, I've been working with some people in #winehackers 
on a way to help solve the problems Wine faces with OpenGL.. namely the lack 
of useable onscreen pixel formats and broken child windown rendering. Here's 
a patch for your perusal in hopes to generate feedback.

What this does is, it renders GL to an offscreen buffer the size of the window 
it's rendering to, first trying a redirected window (if you have the 
Xcomposite extension), then falling back to GLXPixmaps (which may be slower, 
especially if you don't have AIGLX). The offscreen buffer is then copied to 
the window it should be displaying on using X, acting in a manner nearly 
identical to how Vista composites OpenGL (as described here: 
http://www.opengl.org/pipeline/article/vol003_7/ ).

Given that it uses X to do the final composite, it obeys all clipping regions, 
which means it works even on obscured child windows. And since it's 
offscreen, it won't interfere with, or be bothered by, Wine's window. It also 
allows it to use other visuals/pixel formats than Wine's window (not done in 
this patch yet).

There is a speed hit, however. The DX9 swap chains demo, which gets about 280 
FPS for me normally, gets about 80 to 90 FPS with the compositing method. It 
seems to be a ceiling though, as other more GPU intense apps have no extra 
noticeable slow down. Still, as an optimization, it can render directly to 
the window when it's being used on the whole window and the selected pixel 
format matches the current visual (this bit is disabled in the patch since 
it's for testing offscreen rendering, but it's simple to re-enable).

Further, a registry setting (HKCU\Software\Wine\X11 Driver\CompositeGL) can be 
used to force GL compositing off to give you the current behavior (single 
onscreen pixel format, broken child window rendering).


This obviously isn't the final patch, however it's likely what the final 
result will be like, forgoing unforeseen issues. Questions and comments are 
welcome.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine_glwin4.diff
Type: text/x-diff
Size: 57118 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20070821/b0f56ecf/wine_glwin4-0001.bin


More information about the wine-devel mailing list