wined3d: Add a usage flag for static buffer declarations.

This commit is contained in:
Stefan Dösinger 2009-10-20 14:14:45 +02:00 committed by Alexandre Julliard
parent 63326b1925
commit d4275e87f1
4 changed files with 9 additions and 5 deletions

View file

@ -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)

View file

@ -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");

View file

@ -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);

View file

@ -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;