[PATCH 1/4] ddraw: Make D3DVBCAPS_WRITEONLY vertex buffers dynamic

Stefan Dösinger stefan at codeweavers.com
Tue Feb 28 05:19:25 CST 2012


This is for bug 30019.

Out ddraw.dll forwards DDLOCK_DISCARDCONTENTS and DDLOCK_NOOVERWRITE to
wined3d, but wined3d ignores those flags because we never set
WINED3DUSAGE_DYNAMIC. D3d7 docs refer to D3DVBCAPS_WRITEONLY as the flag
to set when creating a buffer, so translate it to DYNAMIC | WRITEONLY.

An argument could be made that we should set the DYNAMIC flag on all
d3d7 buffers, but until I see a game that needs it I prefer to keep
non-D3DVBCAPS_WRITEONLY buffers regular buffers.
---
 dlls/ddraw/vertexbuffer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index fe39e01..c53a186 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -543,7 +543,7 @@ HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, IDirect
         D3DVERTEXBUFFERDESC *desc)
 {
     IDirect3DVertexBufferImpl *buffer;
-    DWORD usage;
+    DWORD usage = WINED3DUSAGE_STATICDECL;
     HRESULT hr = D3D_OK;
 
     TRACE("Vertex buffer description:\n");
@@ -564,8 +564,8 @@ HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, IDirect
     buffer->Caps = desc->dwCaps;
     buffer->fvf = desc->dwFVF;
 
-    usage = desc->dwCaps & D3DVBCAPS_WRITEONLY ? WINED3DUSAGE_WRITEONLY : 0;
-    usage |= WINED3DUSAGE_STATICDECL;
+    if (desc->dwCaps & D3DVBCAPS_WRITEONLY)
+        usage |= WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_DYNAMIC;
 
     wined3d_mutex_lock();
 
-- 
1.7.3.4




More information about the wine-patches mailing list