ddraw: Store the fvf in the ddraw buffer.
WineD3D buffer FVFs will go away soon.
This commit is contained in:
parent
825354afe6
commit
fd9b574e4e
|
@ -687,6 +687,7 @@ struct IDirect3DVertexBufferImpl
|
||||||
|
|
||||||
/*** Storage for D3D7 specific things ***/
|
/*** Storage for D3D7 specific things ***/
|
||||||
DWORD Caps;
|
DWORD Caps;
|
||||||
|
DWORD fvf;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The Vtables */
|
/* The Vtables */
|
||||||
|
|
|
@ -4104,7 +4104,6 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf;
|
IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DWORD stride;
|
DWORD stride;
|
||||||
WINED3DBUFFER_DESC Desc;
|
|
||||||
|
|
||||||
TRACE("(%p)->(%08x,%p,%08x,%08x,%08x)\n", This, PrimitiveType, D3DVertexBuf, StartVertex, NumVertices, Flags);
|
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);
|
ERR("(%p) No Vertex buffer specified\n", This);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
|
stride = get_flexible_vertex_size(vb->fvf);
|
||||||
|
|
||||||
/* Get the FVF of the vertex buffer, and its stride */
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
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,
|
hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice,
|
||||||
vb->wineD3DVertexDeclaration);
|
vb->wineD3DVertexDeclaration);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
|
@ -4229,32 +4219,20 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
{
|
{
|
||||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||||
IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf;
|
IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf;
|
||||||
DWORD stride;
|
DWORD stride = get_flexible_vertex_size(vb->fvf);
|
||||||
WORD *LockedIndices;
|
WORD *LockedIndices;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
WINED3DBUFFER_DESC Desc;
|
|
||||||
|
|
||||||
TRACE("(%p)->(%08x,%p,%d,%d,%p,%d,%08x)\n", This, PrimitiveType, vb, StartVertex, NumVertices, Indices, IndexCount, Flags);
|
TRACE("(%p)->(%08x,%p,%d,%d,%p,%d,%08x)\n", This, PrimitiveType, vb, StartVertex, NumVertices, Indices, IndexCount, Flags);
|
||||||
|
|
||||||
/* Steps:
|
/* Steps:
|
||||||
* 1) Calculate some things: stride, ...
|
* 1) Upload the Indices to the index buffer
|
||||||
* 2) Upload the Indices to the index buffer
|
* 2) Set the index source
|
||||||
* 3) Set the index source
|
* 3) Set the Vertex Buffer as the Stream source
|
||||||
* 4) Set the Vertex Buffer as the Stream source
|
* 4) Call IWineD3DDevice::DrawIndexedPrimitive
|
||||||
* 5) Call IWineD3DDevice::DrawIndexedPrimitive
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
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,
|
hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice,
|
||||||
vb->wineD3DVertexDeclaration);
|
vb->wineD3DVertexDeclaration);
|
||||||
|
|
|
@ -1017,6 +1017,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
|
||||||
|
|
||||||
object->Caps = Desc->dwCaps;
|
object->Caps = Desc->dwCaps;
|
||||||
object->ddraw = This;
|
object->ddraw = This;
|
||||||
|
object->fvf = Desc->dwFVF;
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
hr = IWineD3DDevice_CreateVertexBuffer(This->wineD3DDevice,
|
hr = IWineD3DDevice_CreateVertexBuffer(This->wineD3DDevice,
|
||||||
|
|
|
@ -340,7 +340,6 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
|
||||||
IDirect3DDeviceImpl *D3D = (IDirect3DDeviceImpl *)D3DDevice;
|
IDirect3DDeviceImpl *D3D = (IDirect3DDeviceImpl *)D3DDevice;
|
||||||
BOOL oldClip, doClip;
|
BOOL oldClip, doClip;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
WINED3DBUFFER_DESC Desc;
|
|
||||||
|
|
||||||
TRACE("(%p)->(%08x,%d,%d,%p,%d,%p,%08x)\n", This, VertexOp, DestIndex, Count, Src, SrcIndex, D3D, Flags);
|
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);
|
doClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DBuffer_GetDesc(Src->wineD3DVertexBuffer, &Desc);
|
|
||||||
IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
|
IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
|
||||||
0, /* Stream No */
|
0, /* Stream No */
|
||||||
Src->wineD3DVertexBuffer,
|
Src->wineD3DVertexBuffer,
|
||||||
0, /* Offset */
|
0, /* Offset */
|
||||||
get_flexible_vertex_size(Desc.FVF));
|
get_flexible_vertex_size(Src->fvf));
|
||||||
IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice,
|
IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice,
|
||||||
Src->wineD3DVertexDeclaration);
|
Src->wineD3DVertexDeclaration);
|
||||||
hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice,
|
hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice,
|
||||||
|
@ -452,8 +450,8 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
|
||||||
|
|
||||||
/* Now fill the Desc structure */
|
/* Now fill the Desc structure */
|
||||||
Desc->dwCaps = This->Caps;
|
Desc->dwCaps = This->Caps;
|
||||||
Desc->dwFVF = WDesc.FVF;
|
Desc->dwFVF = This->fvf;
|
||||||
Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(WDesc.FVF);
|
Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(This->fvf);
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
|
|
Loading…
Reference in New Issue