diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c index 798518ac5e6..a89d99883db 100644 --- a/dlls/ddraw/direct3d.c +++ b/dlls/ddraw/direct3d.c @@ -970,6 +970,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface, IDirectDrawImpl *This = ddraw_from_d3d7(iface); IDirect3DVertexBufferImpl *object; HRESULT hr; + DWORD usage; TRACE("(%p)->(%p,%p,%08x)\n", This, Desc, VertexBuffer, Flags); TRACE("(%p) Vertex buffer description:\n", This); @@ -1009,10 +1010,13 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface, object->ddraw = This; object->fvf = Desc->dwFVF; + usage = Desc->dwCaps & D3DVBCAPS_WRITEONLY ? WINED3DUSAGE_WRITEONLY : 0; + usage |= WINED3DUSAGE_STATICDECL; + EnterCriticalSection(&ddraw_cs); hr = IWineD3DDevice_CreateVertexBuffer(This->wineD3DDevice, get_flexible_vertex_size(Desc->dwFVF) * Desc->dwNumVertices, - Desc->dwCaps & D3DVBCAPS_WRITEONLY ? WINED3DUSAGE_WRITEONLY : 0, Desc->dwFVF, + usage, Desc->dwFVF, Desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT, &object->wineD3DVertexBuffer, (IUnknown *)object, &ddraw_null_wined3d_parent_ops); if(hr != D3D_OK) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 30ae8166d1e..24b58a5a2bd 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -325,8 +325,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This) */ if (This->flags & WINED3D_BUFFER_HASDESC) { - if(((IWineD3DImpl *)device->wineD3D)->dxVersion == 7 || - This->resource.format_desc->format != WINED3DFMT_VERTEXDATA) return FALSE; + if(This->resource.usage & WINED3DUSAGE_STATICDECL) return FALSE; } TRACE("Finding vertex buffer conversion information\n"); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 59c18e98e0e..e6931ea98a9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -569,8 +569,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface return WINED3DERR_OUTOFVIDEOMEMORY; } - hr = buffer_init(object, This, Length, Usage, WINED3DFMT_UNKNOWN, - Pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL, parent, parent_ops); + hr = buffer_init(object, This, Length, Usage | WINED3DUSAGE_STATICDECL, + WINED3DFMT_UNKNOWN, Pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL, parent, parent_ops); if (FAILED(hr)) { WARN("Failed to initialize buffer, hr %#x\n", hr); diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index 65306a365a9..2534fbbc06b 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -901,6 +901,7 @@ const UINT WINED3DUSAGE_DYNAMIC = 0x00000200; const UINT WINED3DUSAGE_AUTOGENMIPMAP = 0x00000400; const UINT WINED3DUSAGE_DMAP = 0x00004000; const UINT WINED3DUSAGE_MASK = 0x00004fff; +const UINT WINED3DUSAGE_STATICDECL = 0x20000000; const UINT WINED3DUSAGE_OPTIMIZE = 0x40000000; const UINT WINED3DUSAGE_OVERLAY = 0x80000000;