D3D7 -> WineD3D, 2nd attempt

Oliver Stieber oliver_stieber at yahoo.co.uk
Fri Oct 14 14:27:54 CDT 2005


--- Stefan Dösinger <stefandoesinger at gmx.at> wrote:

> Hello,
> I have come across a D3D7 call where I need some help with: 
> IDirect3DDevice::DrawIndexedPrimitiveVB. The prototype is
> DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
> 						     D3DPRIMITIVETYPE d3dptPrimitiveType,
> 						     LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
> 						     DWORD dwStartVertex,
> 						     DWORD dwNumVertices,
> 						     LPWORD lpwIndices,
> 						     DWORD dwIndexCount,
> 						     DWORD dwFlags)


> 
> I can't find any usable information about it on MSDN, and there's no 
> equivalent in other D3D versions and WineD3D.
> 
> Is there an easy translation to IWineD3DDevice::DrawIndexedPrimitive 
> orIWineD3DDevice::DrawIndexedPrimitiveUP, or do I have to add this call to 
> WineD3D(based on the old implementation in D3D7 perhaps?).


I think the best thing to do is to create another function in wined3d/device.c
DrawIndexedPrimitiveVB that is based on DrawIndexedPrimitiveUP but either takes a
IWineD3DVertexBuffer or has the caller use SetVertexBuffer and then call DrawIndexedPrimitiveVB .

e.g.

IWineD3DDeviceImpl_DrawIndexedPrimitiveVB(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,
                                          UINT MinVertexIndex, UINT NumVertices, CONST void*
pIndexData) {
/* The rest of the code making up IWineD3DDeviceImpl_DrawIndexedPrimitiveVB */
}


DirectX7_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
 						     D3DPRIMITIVETYPE d3dptPrimitiveType,
 						     LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
 						     DWORD dwStartVertex,
 						     DWORD dwNumVertices,
 						     LPWORD lpwIndices,
 						     DWORD dwIndexCount,
 						     DWORD dwFlags) {
 
    IWineD3DDeviceImpl_SetStreamSource(device, 0, lpD3DVertexBuf->wineD3DVertexBuffer,
                               dwStartVertex * lpD3DVertexBuf->stride, lpD3DVertexBuf->stride);
   IWineD3DDeviceImpl_DrawIndexedPrimitiveVB(device, PrimitiveType, dwIndexCount, lpwIndices);
}                                          

Or.

IWineD3DDeviceImpl_DrawIndexedPrimitiveVB(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,
                                          UINT MinVertexIndex, UINT NumVertices, 
                                          CONST void* pIndexData, 
                                          IWineD3DVertexBuffer* pVertexBuffer, 
                                          UINT dwStartVertex, UINT Stride) {

    IWineD3DDeviceImpl_SetStreamSource(device, 0, pVertexBuffer,  dwStartVertex * Stride, Stride);
   /* The rest of the code making up IWineD3DDeviceImpl_DrawIndexedPrimitiveVB */
}

IDirect3DVertexBuffer7 need to wrap wined3dVertexBuffer.

Oliver.


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com



More information about the wine-devel mailing list