Module: wine Branch: master Commit: fd9b574e4e4a42683e2a2e276c5e2d6311cbeb10 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd9b574e4e4a42683e2a2e276c...
Author: Stefan Dösinger stefan@codeweavers.com Date: Mon Apr 6 14:09:54 2009 +0200
ddraw: Store the fvf in the ddraw buffer.
WineD3D buffer FVFs will go away soon.
---
dlls/ddraw/ddraw_private.h | 1 + dlls/ddraw/device.c | 34 ++++++---------------------------- dlls/ddraw/direct3d.c | 1 + dlls/ddraw/vertexbuffer.c | 8 +++----- 4 files changed, 11 insertions(+), 33 deletions(-)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index f9bffd8..72dfff5 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -687,6 +687,7 @@ struct IDirect3DVertexBufferImpl
/*** Storage for D3D7 specific things ***/ DWORD Caps; + DWORD fvf; };
/* The Vtables */ diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index a6b42a2..37bb1ff 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -4104,7 +4104,6 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf; HRESULT hr; DWORD stride; - WINED3DBUFFER_DESC Desc;
TRACE("(%p)->(%08x,%p,%08x,%08x,%08x)\n", This, PrimitiveType, D3DVertexBuf, StartVertex, NumVertices, Flags);
@@ -4114,18 +4113,9 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, ERR("(%p) No Vertex buffer specified\n", This); return DDERR_INVALIDPARAMS; } + stride = get_flexible_vertex_size(vb->fvf);
- /* Get the FVF of the vertex buffer, and its stride */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DBuffer_GetDesc(vb->wineD3DVertexBuffer, &Desc); - if(hr != D3D_OK) - { - ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr); - LeaveCriticalSection(&ddraw_cs); - return hr; - } - stride = get_flexible_vertex_size(Desc.FVF); - hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, vb->wineD3DVertexDeclaration); if(FAILED(hr)) @@ -4229,32 +4219,20 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf; - DWORD stride; + DWORD stride = get_flexible_vertex_size(vb->fvf); WORD *LockedIndices; HRESULT hr; - WINED3DBUFFER_DESC Desc;
TRACE("(%p)->(%08x,%p,%d,%d,%p,%d,%08x)\n", This, PrimitiveType, vb, StartVertex, NumVertices, Indices, IndexCount, Flags);
/* Steps: - * 1) Calculate some things: stride, ... - * 2) Upload the Indices to the index buffer - * 3) Set the index source - * 4) Set the Vertex Buffer as the Stream source - * 5) Call IWineD3DDevice::DrawIndexedPrimitive + * 1) Upload the Indices to the index buffer + * 2) Set the index source + * 3) Set the Vertex Buffer as the Stream source + * 4) Call IWineD3DDevice::DrawIndexedPrimitive */
EnterCriticalSection(&ddraw_cs); - /* Get the FVF of the vertex buffer, and its stride */ - hr = IWineD3DBuffer_GetDesc(vb->wineD3DVertexBuffer, &Desc); - if(hr != D3D_OK) - { - ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr); - LeaveCriticalSection(&ddraw_cs); - return hr; - } - stride = get_flexible_vertex_size(Desc.FVF); - TRACE("Vertex buffer FVF = %08x, stride=%d\n", Desc.FVF, stride);
hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, vb->wineD3DVertexDeclaration); diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c index abeb882..438b6ad 100644 --- a/dlls/ddraw/direct3d.c +++ b/dlls/ddraw/direct3d.c @@ -1017,6 +1017,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
object->Caps = Desc->dwCaps; object->ddraw = This; + object->fvf = Desc->dwFVF;
EnterCriticalSection(&ddraw_cs); hr = IWineD3DDevice_CreateVertexBuffer(This->wineD3DDevice, diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c index 8157334..de94791 100644 --- a/dlls/ddraw/vertexbuffer.c +++ b/dlls/ddraw/vertexbuffer.c @@ -340,7 +340,6 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface, IDirect3DDeviceImpl *D3D = (IDirect3DDeviceImpl *)D3DDevice; BOOL oldClip, doClip; HRESULT hr; - WINED3DBUFFER_DESC Desc;
TRACE("(%p)->(%08x,%d,%d,%p,%d,%p,%08x)\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
@@ -372,12 +371,11 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface, doClip); }
- IWineD3DBuffer_GetDesc(Src->wineD3DVertexBuffer, &Desc); IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice, 0, /* Stream No */ Src->wineD3DVertexBuffer, 0, /* Offset */ - get_flexible_vertex_size(Desc.FVF)); + get_flexible_vertex_size(Src->fvf)); IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice, Src->wineD3DVertexDeclaration); hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice, @@ -452,8 +450,8 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
/* Now fill the Desc structure */ Desc->dwCaps = This->Caps; - Desc->dwFVF = WDesc.FVF; - Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(WDesc.FVF); + Desc->dwFVF = This->fvf; + Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(This->fvf); LeaveCriticalSection(&ddraw_cs);
return D3D_OK;