noob req: ddraw/vertexbuffer.c and HW vertex buffers

Stefan Dösinger stefan at
Sat Nov 8 10:18:24 CST 2008

As you have correctly guessed, hardware vertex buffers are supported in
wined3d. The comment is somewhat outdated - it predates support for opengl
vertex buffer objects.

If you want to implement this method, I recommend doing it this way:

1) Write some tests. See how VertexBuffer::Optimize works together with
VertexBuffer::Lock, and if the D3DVBCAPS_OPTIMIZED flag is visible in

2) Add a IWineD3DVertexBuffer::Optimize method to IWineD3DVertexBuffer and
call it from IDirect3DVertexBuffer::Optimize

3) The optimization is what IWineD3DVertexBuffer::PreLoad does. The code for
that already exists, but it is usually disabled for D3D7 vertex buffers
because in d3d7 only the whole vertex buffer can be locked, and not a
subrange. This makes the color conversions, etc. inefficient with d3d7.

So VertexBuffer::Optimize would probably just set the flag to signal that
PreLoad should create a VBO for this vertex buffer the next time it is
called, and set the OPTIMIZED flag to mark the buffer unlockable(If that is
what the tests written in step (1) show).

More information about the wine-devel mailing list