Commit 5f8c62e4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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.
parent 46eabd5b
...@@ -5141,7 +5141,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI ...@@ -5141,7 +5141,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); 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 */ /* 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 */); 0 /* indxSize */, NULL /* indxData */, 0 /* minIndex */);
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -5194,7 +5194,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice * ...@@ -5194,7 +5194,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); 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); idxStride, vbo ? NULL : ((IWineD3DIndexBufferImpl *) pIB)->resource.allocatedMemory, minIndex);
return WINED3D_OK; return WINED3D_OK;
...@@ -5227,8 +5227,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, ...@@ -5227,8 +5227,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
/* TODO: Only mark dirty if drawing from a different UP address */ /* TODO: Only mark dirty if drawing from a different UP address */
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* start vertex */, 0 /* NumVertices */, drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* NumVertices */,
0 /* indxStart*/, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */); 0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */);
/* MSDN specifies stream zero settings must be set to NULL */ /* MSDN specifies stream zero settings must be set to NULL */
This->stateBlock->streamStride[0] = 0; This->stateBlock->streamStride[0] = 0;
...@@ -5281,7 +5281,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice * ...@@ -5281,7 +5281,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); 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 */ /* MSDN specifies stream zero settings and index buffer must be set to NULL */
This->stateBlock->streamSource[0] = NULL; This->stateBlock->streamSource[0] = NULL;
...@@ -5312,7 +5312,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if ...@@ -5312,7 +5312,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
This->stateBlock->baseVertexIndex = 0; This->stateBlock->baseVertexIndex = 0;
This->up_strided = DrawPrimStrideData; 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; This->up_strided = NULL;
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -5334,7 +5334,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev ...@@ -5334,7 +5334,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
This->stateBlock->streamIsUP = TRUE; This->stateBlock->streamIsUP = TRUE;
This->stateBlock->baseVertexIndex = 0; This->stateBlock->baseVertexIndex = 0;
This->up_strided = DrawPrimStrideData; 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; This->up_strided = NULL;
return WINED3D_OK; return WINED3D_OK;
} }
......
...@@ -253,8 +253,9 @@ void primitiveDeclarationConvertToStridedData( ...@@ -253,8 +253,9 @@ void primitiveDeclarationConvertToStridedData(
} }
} }
static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum glPrimitiveType, static void drawStridedFast(IWineD3DDevice *iface, UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) { const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
if (idxSize != 0 /* This crashes sometimes!*/) { if (idxSize != 0 /* This crashes sometimes!*/) {
...@@ -273,8 +274,8 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum ...@@ -273,8 +274,8 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
#endif #endif
} else { } else {
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startVertex, numberOfVertices); TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startIdx, numberOfVertices);
glDrawArrays(glPrimitiveType, startVertex, numberOfVertices); glDrawArrays(glPrimitiveType, startIdx, numberOfVertices);
checkGLcall("glDrawArrays"); checkGLcall("glDrawArrays");
} }
...@@ -287,7 +288,7 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum ...@@ -287,7 +288,7 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
*/ */
static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT NumVertexes, 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; unsigned int textureNo = 0;
const WORD *pIdxBufS = NULL; const WORD *pIdxBufS = NULL;
...@@ -295,7 +296,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStrid ...@@ -295,7 +296,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStrid
ULONG vx_index; ULONG vx_index;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const UINT *streamOffset = This->stateBlock->streamOffset; 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 pixelShader = use_ps(This->stateBlock);
BOOL specular_fog = FALSE; BOOL specular_fog = FALSE;
UINT texture_stages = GL_LIMITS(texture_stages); UINT texture_stages = GL_LIMITS(texture_stages);
...@@ -597,10 +598,10 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, const DWORD type, co ...@@ -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, 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; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex; long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
const WORD *pIdxBufS = NULL; const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL; const DWORD *pIdxBufL = NULL;
ULONG vx_index; ULONG vx_index;
...@@ -658,7 +659,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStr ...@@ -658,7 +659,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStr
static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd,
UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex,
ULONG startIdx, ULONG startVertex) ULONG startIdx)
{ {
UINT numInstances = 0, i; UINT numInstances = 0, i;
int numInstancedAttribs = 0, j; int numInstancedAttribs = 0, j;
...@@ -811,16 +812,9 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStrid ...@@ -811,16 +812,9 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStrid
} }
/* Routine common to the draw primitive and draw indexed primitive routines */ /* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface, void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
int PrimitiveType, UINT numberOfVertices, long StartIdx, short idxSize, const void *idxData, int minIndex)
long NumPrimitives, {
/* for Indexed: */
long StartVertexIndex,
UINT numberOfVertices,
long StartIdx,
short idxSize,
const void *idxData,
int minIndex) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *target; IWineD3DSurfaceImpl *target;
...@@ -908,19 +902,19 @@ void drawPrimitive(IWineD3DDevice *iface, ...@@ -908,19 +902,19 @@ void drawPrimitive(IWineD3DDevice *iface,
} else { } else {
TRACE("Using immediate mode with vertex shaders for half float emulation\n"); TRACE("Using immediate mode with vertex shaders for half float emulation\n");
} }
drawStridedSlowVs(iface, strided, calculatedNumberOfindices, glPrimType, drawStridedSlowVs(iface, strided, calculatedNumberOfindices,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex); glPrimType, idxData, idxSize, minIndex, StartIdx);
} else { } else {
drawStridedSlow(iface, strided, calculatedNumberOfindices, drawStridedSlow(iface, strided, calculatedNumberOfindices,
glPrimType, idxData, idxSize, minIndex, StartIdx, StartVertexIndex); glPrimType, idxData, idxSize, minIndex, StartIdx);
} }
} else if(This->instancedDraw) { } else if(This->instancedDraw) {
/* Instancing emulation with mixing immediate mode and arrays */ /* Instancing emulation with mixing immediate mode and arrays */
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType, drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex); idxData, idxSize, minIndex, StartIdx);
} else { } else {
drawStridedFast(iface, calculatedNumberOfindices, glPrimType, drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, StartVertexIndex); idxData, idxSize, minIndex, StartIdx);
} }
} }
......
...@@ -641,16 +641,8 @@ extern LONG primCounter; ...@@ -641,16 +641,8 @@ extern LONG primCounter;
*/ */
/* Routine common to the draw primitive and draw indexed primitive routines */ /* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface, void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
int PrimitiveType, UINT numberOfVertices, long start_idx, short idxBytes, const void *idxData, int minIndex);
long NumPrimitives,
/* for Indexed: */
long StartVertexIndex,
UINT numberOfVertices,
long StartIdx,
short idxBytes,
const void *idxData,
int minIndex);
void primitiveDeclarationConvertToStridedData( void primitiveDeclarationConvertToStridedData(
IWineD3DDevice *iface, IWineD3DDevice *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment