Hi,
I've been playing Gothic2 and getting lots of messages regarding d3d7:IDirect3DVertexBufferImpl_Optimize, printed by ddraw/vertexbuffer.c. Reading the comments for that function seems to indicate that vertex buffers are currently emulated in software, and will be handled in hardware as soon as wined3d is capable of that - however, reading wined3d/vertexbuffer.c, especially CreateVBO, implies that hardware/GL vertex buffers are already supported.
Git logs also show that ddraw/vertexbuffer.c has not been changed in a few months. Did I completely mis-interpret the comments, or has this file simply been forgotten? And if so, could some kind soul sacrifice the time to bring it up to speed with the rest of Wine, so that us Gothic players can enjoy better framerates?
Thanks for reading.
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Hi, 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 GetVertexBufferDesc.
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).