From e40bb4a8c3bffba1b5d429508e8fa4cd3cbc3186 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Mon, 11 Feb 2008 12:46:43 +0100 Subject: [PATCH] wined3d: Create a VBO before returning memory. The state manager calls GetMemory before it calls PreLoad on the VBO, and PreLoad depends on finding the VBO in the strided vertex structure. This can cause problems on the first draw which creates the vertex buffer, because the first PreLoad creates the vbo and attempts to convert with an incorrect strided structure. --- dlls/wined3d/vertexbuffer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c index 72cef079cf5..985ac35477a 100644 --- a/dlls/wined3d/vertexbuffer.c +++ b/dlls/wined3d/vertexbuffer.c @@ -801,6 +801,14 @@ BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWO *vbo = This->vbo; if(This->vbo == 0) { + if(This->Flags & VBFLAG_CREATEVBO) { + CreateVBO(This); + This->Flags &= ~VBFLAG_CREATEVBO; + if(This->vbo) { + *vbo = This->vbo; + return (BYTE *) iOffset; + } + } return This->resource.allocatedMemory + iOffset; } else { return (BYTE *) iOffset; -- 2.11.4.GIT