[D3D 96] Actually use the 'dwStartVertex' argument
Lionel Ulmer
lionel.ulmer at free.fr
Mon Feb 10 04:14:07 CST 2003
This patch fixes most (if not all) geometry corruptions in Sacrifice (and I
think in Nascar2002 too).
Sacrifice is still mostly not working due to texturing problems (as we do
not support all the texturing mode it needs).
Changelog:
Use the dwStartVertex argument in the Draw*PrimitiveVB methods
--
Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- ../wine_base/dlls/ddraw/d3d_private.h Thu Jan 30 22:07:23 2003
+++ dlls/ddraw/d3d_private.h Mon Feb 10 11:00:57 2003
@@ -274,7 +274,7 @@
extern void dump_D3DVECTOR(D3DVECTOR *lpVec);
extern void dump_flexible_vertex(DWORD d3dvtVertexType);
extern DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
-extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided);
+extern void convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided, DWORD dwStartVertex);
extern void dump_D3DVOP(DWORD dwVertexOp);
extern void dump_D3DPV(DWORD dwFlags);
--- ../wine_base/dlls/ddraw/d3dcommon.c Thu Jan 30 22:07:23 2003
+++ dlls/ddraw/d3dcommon.c Mon Feb 10 11:02:24 2003
@@ -291,10 +291,13 @@
}
void
-convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided)
+convert_FVF_to_strided_data(DWORD d3dvtVertexType, LPVOID lpvVertices, D3DDRAWPRIMITIVESTRIDEDDATA *strided, DWORD dwStartVertex)
{
int current_offset = 0;
int tex_index;
+ int size = get_flexible_vertex_size(d3dvtVertexType);
+
+ lpvVertices = ((BYTE *) lpvVertices) + (size * dwStartVertex);
if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) {
strided->position.lpvData = lpvVertices;
--- ../wine_base/dlls/ddraw/d3dvertexbuffer.c Sun Jan 5 23:58:59 2003
+++ dlls/ddraw/d3dvertexbuffer.c Mon Feb 10 11:05:59 2003
@@ -426,7 +426,7 @@
if ((dwVertexOp & D3DVOP_TRANSFORM) == 0) return DDERR_INVALIDPARAMS;
size = get_flexible_vertex_size(src_impl->desc.dwFVF);
- convert_FVF_to_strided_data(src_impl->desc.dwFVF, ((char *) src_impl->vertices) + dwSrcIndex * size, &strided);
+ convert_FVF_to_strided_data(src_impl->desc.dwFVF, ((char *) src_impl->vertices) + dwSrcIndex * size, &strided, 0);
return process_vertices_strided(This, dwVertexOp, dwDestIndex, dwCount, &strided, src_impl->desc.dwFVF, device_impl, dwFlags);
}
--- ../wine_base/dlls/ddraw/d3ddevice/mesa.c Mon Feb 10 09:36:22 2003
+++ dlls/ddraw/d3ddevice/mesa.c Mon Feb 10 11:04:43 2003
@@ -65,7 +65,6 @@
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
- DWORD dwStartVertex,
DWORD dwVertexCount,
LPWORD dwIndices,
DWORD dwIndexCount,
@@ -799,7 +798,7 @@
strided.normal.dwStride = sizeof(D3DVERTEX);
strided.textureCoords[0].lpvData = &((D3DVERTEX *) lpvertex)->u7.tu;
strided.textureCoords[0].dwStride = sizeof(D3DVERTEX);
- draw_primitive_strided(This, d3dpt, D3DFVF_VERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */);
+ draw_primitive_strided(This, d3dpt, D3DFVF_VERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */);
} break;
case D3DVT_LVERTEX: {
@@ -811,7 +810,7 @@
strided.specular.dwStride = sizeof(D3DLVERTEX);
strided.textureCoords[0].lpvData = &((D3DLVERTEX *) lpvertex)->u6.tu;
strided.textureCoords[0].dwStride = sizeof(D3DLVERTEX);
- draw_primitive_strided(This, d3dpt, D3DFVF_LVERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */);
+ draw_primitive_strided(This, d3dpt, D3DFVF_LVERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */);
} break;
case D3DVT_TLVERTEX: {
@@ -823,7 +822,7 @@
strided.specular.dwStride = sizeof(D3DTLVERTEX);
strided.textureCoords[0].lpvData = &((D3DTLVERTEX *) lpvertex)->u7.tu;
strided.textureCoords[0].dwStride = sizeof(D3DTLVERTEX);
- draw_primitive_strided(This, d3dpt, D3DFVF_TLVERTEX, &strided, 0, 0 /* Unused */, index, maxvert, 0 /* Unused */);
+ draw_primitive_strided(This, d3dpt, D3DFVF_TLVERTEX, &strided, 0 /* Unused */, index, maxvert, 0 /* Unused */);
} break;
default:
@@ -1023,7 +1022,6 @@
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
- DWORD dwStartVertex,
DWORD dwVertexCount,
LPWORD dwIndices,
DWORD dwIndexCount,
@@ -1109,7 +1107,7 @@
*/
int index;
for (index = 0; index < dwIndexCount; index++) {
- int i = (dwIndices == NULL) ? index : dwIndices[index];
+ int i = (dwIndices == NULL) ? index : dwIndices[index];
if (d3dvtVertexType & D3DFVF_NORMAL) {
D3DVALUE *normal =
@@ -1231,8 +1229,8 @@
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
- convert_FVF_to_strided_data(d3dvtVertexType, lpvVertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, d3dvtVertexType, &strided, 0, dwVertexCount, NULL, dwVertexCount, dwFlags);
+ convert_FVF_to_strided_data(d3dvtVertexType, lpvVertices, &strided, 0);
+ draw_primitive_strided(This, d3dptPrimitiveType, d3dvtVertexType, &strided, dwVertexCount, NULL, dwVertexCount, dwFlags);
return DD_OK;
}
@@ -1255,8 +1253,8 @@
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
- convert_FVF_to_strided_data(d3dvtVertexType, lpvVertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, d3dvtVertexType, &strided, 0, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
+ convert_FVF_to_strided_data(d3dvtVertexType, lpvVertices, &strided, 0);
+ draw_primitive_strided(This, d3dptPrimitiveType, d3dvtVertexType, &strided, dwVertexCount, dwIndices, dwIndexCount, dwFlags);
return DD_OK;
}
@@ -1275,7 +1273,7 @@
if (TRACE_ON(ddraw)) {
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
- draw_primitive_strided(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, NULL, dwVertexCount, dwFlags);
+ draw_primitive_strided(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, NULL, dwVertexCount, dwFlags);
return DD_OK;
}
@@ -1297,7 +1295,7 @@
TRACE(" - flags : "); dump_DPFLAGS(dwFlags);
}
- draw_primitive_strided(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, 0, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
+ draw_primitive_strided(This, d3dptPrimitiveType, dwVertexType, lpD3DDrawPrimStrideData, dwVertexCount, lpIndex, dwIndexCount, dwFlags);
return DD_OK;
}
@@ -1327,12 +1325,12 @@
This->set_matrices(This, VIEWMAT_CHANGED|WORLDMAT_CHANGED|PROJMAT_CHANGED,
&(vb_glimp->world_mat), &(vb_glimp->view_mat), &(vb_glimp->proj_mat));
- convert_FVF_to_strided_data(vb_glimp->dwVertexTypeDesc, vb_glimp->vertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, vb_glimp->dwVertexTypeDesc, &strided, dwStartVertex, dwNumVertices, NULL, dwNumVertices, dwFlags);
+ convert_FVF_to_strided_data(vb_glimp->dwVertexTypeDesc, vb_glimp->vertices, &strided, dwStartVertex);
+ draw_primitive_strided(This, d3dptPrimitiveType, vb_glimp->dwVertexTypeDesc, &strided, dwNumVertices, NULL, dwNumVertices, dwFlags);
} else {
- convert_FVF_to_strided_data(vb_impl->desc.dwFVF, vb_impl->vertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, &strided, dwStartVertex, dwNumVertices, NULL, dwNumVertices, dwFlags);
+ convert_FVF_to_strided_data(vb_impl->desc.dwFVF, vb_impl->vertices, &strided, dwStartVertex);
+ draw_primitive_strided(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, &strided, dwNumVertices, NULL, dwNumVertices, dwFlags);
}
return DD_OK;
@@ -1365,12 +1363,12 @@
This->set_matrices(This, VIEWMAT_CHANGED|WORLDMAT_CHANGED|PROJMAT_CHANGED,
&(vb_glimp->world_mat), &(vb_glimp->view_mat), &(vb_glimp->proj_mat));
- convert_FVF_to_strided_data(vb_glimp->dwVertexTypeDesc, vb_glimp->vertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, vb_glimp->dwVertexTypeDesc, &strided, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
+ convert_FVF_to_strided_data(vb_glimp->dwVertexTypeDesc, vb_glimp->vertices, &strided, dwStartVertex);
+ draw_primitive_strided(This, d3dptPrimitiveType, vb_glimp->dwVertexTypeDesc, &strided, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
} else {
- convert_FVF_to_strided_data(vb_impl->desc.dwFVF, vb_impl->vertices, &strided);
- draw_primitive_strided(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, &strided, dwStartVertex, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
+ convert_FVF_to_strided_data(vb_impl->desc.dwFVF, vb_impl->vertices, &strided, dwStartVertex);
+ draw_primitive_strided(This, d3dptPrimitiveType, vb_impl->desc.dwFVF, &strided, dwNumVertices, lpwIndices, dwIndexCount, dwFlags);
}
return DD_OK;
More information about the wine-patches
mailing list