D3D49 Changelog: Added 'emulated' VertexBuffer support. -- Lionel Ulmer - http://www.bbrox.org/
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/main.c 2002-12-23 18:34:52.000000000 +0100 +++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/main.c 2002-12-25 21:11:56.000000000 +0100 @@ -427,12 +427,12 @@ } HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - DWORD dwFlags) +Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + DWORD dwFlags) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags); @@ -440,14 +440,14 @@ } HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - LPWORD lpwIndices, - DWORD dwIndexCount, - DWORD dwFlags) +Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + LPWORD lpwIndices, + DWORD dwIndexCount, + DWORD dwFlags) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags); @@ -833,32 +833,6 @@ } HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - DWORD dwFlags) -{ - ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface); - FIXME("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags); - return DD_OK; -} - -HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, - LPWORD lpwIndices, - DWORD dwIndexCount, - DWORD dwFlags) -{ - ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice3, iface); - FIXME("(%p/%p)->(%08x,%p,%p,%08lx,%08lx): stub!\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, lpwIndices, dwIndexCount, dwFlags); - return DD_OK; -} - -HRESULT WINAPI Main_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, DWORD dwStage, LPDIRECT3DTEXTURE2* lplpTexture2) @@ -1771,3 +1745,41 @@ dwStage, COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirect3DTexture2, IDirectDrawSurface7, lpTexture2)); } + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + DWORD dwFlags) +{ + TRACE("(%p)->(%08x,%p,%08lx,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, + d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags); + return IDirect3DDevice7_DrawPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface), + d3dptPrimitiveType, + COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf), + dwStartVertex, + dwNumVertices, + dwFlags); +} + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, + LPWORD lpwIndices, + DWORD dwIndexCount, + DWORD dwFlags) +{ + TRACE("(%p)->(%08x,%p,%p,%08lx,%08lx) thunking to IDirect3DDevice7 interface.\n", iface, + d3dptPrimitiveType, lpD3DVertexBuf, lpwIndices, dwIndexCount, dwFlags); + return IDirect3DDevice7_DrawIndexedPrimitiveVB(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface), + d3dptPrimitiveType, + COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, lpD3DVertexBuf), + 0, + dwIndexCount, + lpwIndices, + dwIndexCount, + dwFlags); +} --- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/mesa.c 2002-12-25 17:25:28.000000000 +0100 +++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/mesa.c 2002-12-25 21:20:21.000000000 +0100 @@ -63,6 +63,7 @@ D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD d3dvtVertexType, LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData, + DWORD dwStartVertex, DWORD dwVertexCount, LPWORD dwIndices, DWORD dwIndexCount, @@ -765,7 +766,7 @@ strided.normal.dwStride = sizeof(D3DVERTEX); strided.textureCoords[0].lpvData = &((D3DVERTEX *) lpvertex)->u7.tu; strided.textureCoords[0].dwStride = sizeof(D3DVERTEX); - draw_primitive_strided_7(This, d3dpt, D3DFVF_VERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */); + draw_primitive_strided_7(This, d3dpt, D3DFVF_VERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */); } break; case D3DVT_LVERTEX: { @@ -777,7 +778,7 @@ strided.specular.dwStride = sizeof(D3DLVERTEX); strided.textureCoords[0].lpvData = &((D3DLVERTEX *) lpvertex)->u6.tu; strided.textureCoords[0].dwStride = sizeof(D3DLVERTEX); - draw_primitive_strided_7(This, d3dpt, D3DFVF_LVERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */); + draw_primitive_strided_7(This, d3dpt, D3DFVF_LVERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */); } break; case D3DVT_TLVERTEX: { @@ -789,7 +790,7 @@ strided.specular.dwStride = sizeof(D3DTLVERTEX); strided.textureCoords[0].lpvData = &((D3DTLVERTEX *) lpvertex)->u7.tu; strided.textureCoords[0].dwStride = sizeof(D3DTLVERTEX); - draw_primitive_strided_7(This, d3dpt, D3DFVF_TLVERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */); + draw_primitive_strided_7(This, d3dpt, D3DFVF_TLVERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */); } break; default: @@ -963,6 +964,7 @@ D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD d3dvtVertexType, LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData, + DWORD dwStartVertex, DWORD dwVertexCount, LPWORD dwIndices, DWORD dwIndexCount, @@ -1153,6 +1155,7 @@ D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD d3dvtVertexType, LPVOID lpvVertices, + DWORD dwStartVertex, DWORD dwVertexCount, LPWORD dwIndices, DWORD dwIndexCount, @@ -1192,7 +1195,7 @@ for (tex_index = 0; tex_index < ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); tex_index++) strided.textureCoords[tex_index].dwStride = current_offset; - draw_primitive_strided_7(This, d3dptPrimitiveType, d3dvtVertexType, &strided, dwVertexCount, dwIndices, dwIndexCount, dwFlags); + draw_primitive_strided_7(This, d3dptPrimitiveType, d3dvtVertexType, &strided, dwStartVertex, dwVertexCount, dwIndices, dwIndexCount, dwFlags); } HRESULT WINAPI @@ -1206,7 +1209,7 @@ ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwFlags); - draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, NULL, dwVertexCount, dwFlags); + draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, 0, dwVertexCount, NULL, dwVertexCount, dwFlags); return DD_OK; } @@ -1224,7 +1227,7 @@ ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags); - draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, dwVertexCount, dwIndices, dwIndexCount, dwFlags); + draw_primitive_7(This, d3dptPrimitiveType, d3dvtVertexType, lpvVertices, 0, dwVertexCount, dwIndices, dwIndexCount, dwFlags); return DD_OK; } @@ -1239,7 +1242,7 @@ { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, dwFlags); - draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, NULL, dwVertexCount, dwFlags); + draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, NULL, dwVertexCount, dwFlags); return DD_OK; } @@ -1255,7 +1258,45 @@ { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); TRACE("(%p/%p)->(%08x,%08lx,%p,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags); - draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags); + draw_primitive_strided_7(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, lpIndex, dwIndexCount, dwFlags); + return DD_OK; +} + +HRESULT WINAPI +GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + DWORD dwFlags) +{ + ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); + IDirect3DVertexBufferImpl *vb_impl = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, lpD3DVertexBuf); + + TRACE("(%p/%p)->(%08x,%p,%08lx,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, dwFlags); + + draw_primitive_7(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, vb_impl->vertices, dwStartVertex, dwNumVertices, NULL, dwNumVertices, dwFlags); + + return DD_OK; +} + +HRESULT WINAPI +GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + LPWORD lpwIndices, + DWORD dwIndexCount, + DWORD dwFlags) +{ + ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); + IDirect3DVertexBufferImpl *vb_impl = ICOM_OBJECT(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, lpD3DVertexBuf); + + TRACE("(%p/%p)->(%08x,%p,%08lx,%08lx,%p,%08lx,%08lx)\n", This, iface, d3dptPrimitiveType, lpD3DVertexBuf, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags); + + draw_primitive_7(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, vb_impl->vertices, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags); + return DD_OK; } @@ -1459,8 +1500,8 @@ XCAST(GetClipStatus) Main_IDirect3DDeviceImpl_7_3T_2T_GetClipStatus, XCAST(DrawPrimitiveStrided) GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveStrided, XCAST(DrawIndexedPrimitiveStrided) GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveStrided, - XCAST(DrawPrimitiveVB) Main_IDirect3DDeviceImpl_7_DrawPrimitiveVB, - XCAST(DrawIndexedPrimitiveVB) Main_IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB, + XCAST(DrawPrimitiveVB) GL_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB, + XCAST(DrawIndexedPrimitiveVB) GL_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB, XCAST(ComputeSphereVisibility) Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility, XCAST(GetTexture) Main_IDirect3DDeviceImpl_7_GetTexture, XCAST(SetTexture) GL_IDirect3DDeviceImpl_7_3T_SetTexture, @@ -1527,8 +1568,8 @@ XCAST(GetClipStatus) Thunk_IDirect3DDeviceImpl_3_GetClipStatus, XCAST(DrawPrimitiveStrided) Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided, XCAST(DrawIndexedPrimitiveStrided) Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided, - XCAST(DrawPrimitiveVB) Main_IDirect3DDeviceImpl_3_DrawPrimitiveVB, - XCAST(DrawIndexedPrimitiveVB) Main_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB, + XCAST(DrawPrimitiveVB) Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB, + XCAST(DrawIndexedPrimitiveVB) Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB, XCAST(ComputeSphereVisibility) Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility, XCAST(GetTexture) Main_IDirect3DDeviceImpl_3_GetTexture, XCAST(SetTexture) Thunk_IDirect3DDeviceImpl_3_SetTexture, --- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/main.h 2002-12-23 15:30:02.000000000 +0100 +++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/main.h 2002-12-25 20:51:32.000000000 +0100 @@ -175,22 +175,22 @@ DWORD dwFlags); HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - DWORD dwFlags); - -HRESULT WINAPI -Main_IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - LPWORD lpwIndices, - DWORD dwIndexCount, - DWORD dwFlags); +Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + DWORD dwFlags); + +HRESULT WINAPI +Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + LPWORD lpwIndices, + DWORD dwIndexCount, + DWORD dwFlags); HRESULT WINAPI Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface, @@ -345,22 +345,6 @@ DWORD dwLightState); HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, - DWORD dwStartVertex, - DWORD dwNumVertices, - DWORD dwFlags); - -HRESULT WINAPI -Main_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, - LPWORD lpwIndices, - DWORD dwIndexCount, - DWORD dwFlags); - -HRESULT WINAPI Main_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface, DWORD dwStage, LPDIRECT3DTEXTURE2* lplpTexture2); @@ -757,3 +741,19 @@ Thunk_IDirect3DDeviceImpl_3_SetTexture(LPDIRECT3DDEVICE3 iface, DWORD dwStage, LPDIRECT3DTEXTURE2 lpTexture2); + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, + DWORD dwStartVertex, + DWORD dwNumVertices, + DWORD dwFlags); + +HRESULT WINAPI +Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, + LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf, + LPWORD lpwIndices, + DWORD dwIndexCount, + DWORD dwFlags); --- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dvertexbuffer.c 2002-12-22 12:06:18.000000000 +0100 +++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dvertexbuffer.c 2002-12-25 20:34:15.000000000 +0100 @@ -313,9 +313,9 @@ if (TRACE_ON(ddraw)) { TRACE(" creating implementation at %p with description : \n", *obj); - TRACE(" - "); DDRAW_dump_flags_(lpD3DVertBufDesc->dwCaps, flags, sizeof(flags)/sizeof(flags[0]), TRUE); - TRACE(" - "); dump_flexible_vertex(lpD3DVertBufDesc->dwFVF); - TRACE(" - %ld\n", lpD3DVertBufDesc->dwNumVertices); + TRACE(" flags : - "); DDRAW_dump_flags_(lpD3DVertBufDesc->dwCaps, flags, sizeof(flags)/sizeof(flags[0]), TRUE); + TRACE(" vertex type : - "); dump_flexible_vertex(lpD3DVertBufDesc->dwFVF); + TRACE(" num vertices : - %ld\n", lpD3DVertBufDesc->dwNumVertices); }