VBO patch

Antoine Chavasse <[email protected]> Mon, 23 Aug 2004 11:13:30 +0200
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
Hello,

I've been trying to improve the performances of Anarchy Online under 
wine, and especially find out why it's much slower with ATI cards than 
nvidia.

I think it's because nvidia uses VAR, while ATI uses plain vertex 
arrays, as VBO support was removed from CVS.

I tried to re-enable it (by getting the previous versions of 
x11drv/makefile.in and executebuffer.c from cvs, where th vbo support 
was enabled), and to fix the massive rendering problems (it was 
rendering almost only random polygons) it was causing. It turned out 
that in d3dgl/fixedfunc.c, in GL_load_arrays(), the glXXXPointer 
functions were only called if the adress/stride to set changed since the 
last call.

It's bad with VBO. I think the driver internally computes the actual 
start adress of the buffer at this time, using the current bound vertex 
buffer and the offset given to the function, so not caling this function 
after binding a new buffer leave the internal buffer address actually 
used for rendering unchanged.
I don't have any glitch whatsoever with my patch, and it almost doubled 
the framerate in AO in some cases. I only tried it on my pc, though, 
although with two different motherboards and several different versions 
of the ATI drivers.

What worries me however, is that I've seen rendering problems mentioned 
about everywhere concerning VBO and WineX, but only "rendering 
problems", not "trashed polygons all over the screen" like I was getting 
before I changed fixedfunc.c.

And it also seems that VBO is compiled in the official binaries (as grep 
finds stuff like the "ARB_VBO" string in the binaries, that are nowhere 
to be found in the cvs source), so I don't know how outdated the VBO 
code in CVS is (if it is), and whether this fix could be applicable to 
the official version. And I've not been able to try the official 
binaries with AO, since Marius' patches aren't merged yet.

I also did another optimisation in x11drv/executebuffer.c: I added a 
counter to know how many vertices remain to be converted, so the entire 
buffer convertion function can be omitted if all the vertices of the 
buffer are known to have been converted, instead of checking the 
uptodate flags for all of them. oprofile showed that a lot of time was 
wasted there.

So, what the patch does is revert x11drv/makefile.in and 
x11drv/executebuffer.c to the about 3 month ago versions where vbo 
support was enabled (hence the size), changes d3dgl/fixedfunc.c to make 
it so the glXXXpointer functions are called every time GL_load_arrays is 
called, and adds the count optimisation thingy in x11drv/executebuffer.c.
On nvidia cards, though, VAR is still used over VBO if available.
VBO_Patch.diff.gz (application/octet-stream, 11.2 KB) - not displayed