wined3d: Remove a redundant parameter to drawPrimitive().

startIdx should be the first index to draw, either from the vertex
array or the index array, depending on if the draw is indexed or
not. Having both at the same time wouldn't make sense.
This commit is contained in:
Henri Verbeet 2009-01-07 09:00:55 +01:00 committed by Alexandre Julliard
parent 46eabd5b16
commit 5f8c62e45d
3 changed files with 27 additions and 41 deletions

View File

@ -5141,7 +5141,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
}
/* Account for the loading offset due to index buffers. Instead of reloading all sources correct it with the startvertex parameter */
drawPrimitive(iface, PrimitiveType, PrimitiveCount, StartVertex, 0/* NumVertices */, -1 /* indxStart */,
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0/* NumVertices */, StartVertex /* start_idx */,
0 /* indxSize */, NULL /* indxData */, 0 /* minIndex */);
return WINED3D_OK;
}
@ -5194,7 +5194,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
}
drawPrimitive(iface, PrimitiveType, primCount, 0, NumVertices, startIndex,
drawPrimitive(iface, PrimitiveType, primCount, NumVertices, startIndex,
idxStride, vbo ? NULL : ((IWineD3DIndexBufferImpl *) pIB)->resource.allocatedMemory, minIndex);
return WINED3D_OK;
@ -5227,8 +5227,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
/* TODO: Only mark dirty if drawing from a different UP address */
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* start vertex */, 0 /* NumVertices */,
0 /* indxStart*/, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* NumVertices */,
0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */);
/* MSDN specifies stream zero settings must be set to NULL */
This->stateBlock->streamStride[0] = 0;
@ -5281,7 +5281,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* vertexStart */, NumVertices, 0 /* indxStart */, idxStride, pIndexData, MinVertexIndex);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, NumVertices, 0 /* start_idx */, idxStride, pIndexData, MinVertexIndex);
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
This->stateBlock->streamSource[0] = NULL;
@ -5312,7 +5312,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
This->stateBlock->baseVertexIndex = 0;
This->up_strided = DrawPrimStrideData;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, 0, NULL, 0);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, NULL, 0);
This->up_strided = NULL;
return WINED3D_OK;
}
@ -5334,7 +5334,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
This->stateBlock->streamIsUP = TRUE;
This->stateBlock->baseVertexIndex = 0;
This->up_strided = DrawPrimStrideData;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* startvertexidx */, 0 /* numindices */, 0 /* startidx */, idxSize, pIndexData, 0 /* minindex */);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* numindices */, 0 /* start_idx */, idxSize, pIndexData, 0 /* minindex */);
This->up_strided = NULL;
return WINED3D_OK;
}

View File

@ -253,8 +253,9 @@ void primitiveDeclarationConvertToStridedData(
}
}
static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) {
static void drawStridedFast(IWineD3DDevice *iface, UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
if (idxSize != 0 /* This crashes sometimes!*/) {
@ -273,8 +274,8 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
#endif
} else {
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startVertex, numberOfVertices);
glDrawArrays(glPrimitiveType, startVertex, numberOfVertices);
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startIdx, numberOfVertices);
glDrawArrays(glPrimitiveType, startIdx, numberOfVertices);
checkGLcall("glDrawArrays");
}
@ -287,7 +288,7 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
*/
static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT NumVertexes,
GLenum glPrimType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
GLenum glPrimType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx)
{
unsigned int textureNo = 0;
const WORD *pIdxBufS = NULL;
@ -295,7 +296,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStrid
ULONG vx_index;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const UINT *streamOffset = This->stateBlock->streamOffset;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
BOOL pixelShader = use_ps(This->stateBlock);
BOOL specular_fog = FALSE;
UINT texture_stages = GL_LIMITS(texture_stages);
@ -597,10 +598,10 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, const DWORD type, co
}
static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL;
ULONG vx_index;
@ -658,7 +659,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStr
static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd,
UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex,
ULONG startIdx, ULONG startVertex)
ULONG startIdx)
{
UINT numInstances = 0, i;
int numInstancedAttribs = 0, j;
@ -811,16 +812,9 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStrid
}
/* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface,
int PrimitiveType,
long NumPrimitives,
/* for Indexed: */
long StartVertexIndex,
UINT numberOfVertices,
long StartIdx,
short idxSize,
const void *idxData,
int minIndex) {
void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
UINT numberOfVertices, long StartIdx, short idxSize, const void *idxData, int minIndex)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *target;
@ -908,19 +902,19 @@ void drawPrimitive(IWineD3DDevice *iface,
} else {
TRACE("Using immediate mode with vertex shaders for half float emulation\n");
}
drawStridedSlowVs(iface, strided, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
drawStridedSlowVs(iface, strided, calculatedNumberOfindices,
glPrimType, idxData, idxSize, minIndex, StartIdx);
} else {
drawStridedSlow(iface, strided, calculatedNumberOfindices,
glPrimType, idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
glPrimType, idxData, idxSize, minIndex, StartIdx);
}
} else if(This->instancedDraw) {
/* Instancing emulation with mixing immediate mode and arrays */
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
idxData, idxSize, minIndex, StartIdx);
} else {
drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
idxData, idxSize, minIndex, StartIdx);
}
}

View File

@ -641,16 +641,8 @@ extern LONG primCounter;
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface,
int PrimitiveType,
long NumPrimitives,
/* for Indexed: */
long StartVertexIndex,
UINT numberOfVertices,
long StartIdx,
short idxBytes,
const void *idxData,
int minIndex);
void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
UINT numberOfVertices, long start_idx, short idxBytes, const void *idxData, int minIndex);
void primitiveDeclarationConvertToStridedData(
IWineD3DDevice *iface,