Stefan Dösinger : wined3d: Create a VBO before returning memory.

Alexandre Julliard julliard at winehq.org
Tue Feb 19 08:05:30 CST 2008


Module: wine
Branch: master
Commit: e40bb4a8c3bffba1b5d429508e8fa4cd3cbc3186
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e40bb4a8c3bffba1b5d429508e8fa4cd3cbc3186

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Feb 11 12:46:43 2008 +0100

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 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c
index 72cef07..985ac35 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;




More information about the wine-cvs mailing list