From ffce7187652c497146ab5bdfd9d2173294c0c50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 20 Oct 2009 14:14:45 +0200 Subject: [PATCH 03/10] WineD3D: Add a usage flag for static buffer declarations --- dlls/ddraw/direct3d.c | 6 +++++- dlls/wined3d/buffer.c | 3 +-- dlls/wined3d/device.c | 4 ++-- include/wine/wined3d.idl | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c index 798518a..a89d998 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 30ae816..24b58a5 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 59c18e9..e6931ea 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 65306a3..2534fbb 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; -- 1.6.4.4