From 2b2fc827ce1f340554cc8d01f6b183d4a5c02114 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 10 Sep 2009 16:57:16 +0200 Subject: [PATCH] wined3d: Remove unused parameters to drawPrimitive(). --- dlls/d3d8/device.c | 6 +++--- dlls/d3d9/device.c | 6 +++--- dlls/ddraw/device.c | 8 +++----- dlls/wined3d/device.c | 33 ++++++++++++++------------------ dlls/wined3d/drawprim.c | 35 ++++++++++++---------------------- dlls/wined3d/wined3d_private.h | 3 +-- include/wine/wined3d.idl | 4 ---- 7 files changed, 36 insertions(+), 59 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 675eac134f3..30195c6eac2 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1725,8 +1725,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE wined3d_mutex_lock(); IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices, - startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); + hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex, + vertex_count_from_primitive_count(PrimitiveType, primCount)); wined3d_mutex_unlock(); return hr; @@ -1757,7 +1757,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI wined3d_mutex_lock(); IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices, + hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 99958239496..a5c0c5d0767 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1484,8 +1484,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVI wined3d_mutex_lock(); IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex); IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices, - startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); + hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex, + vertex_count_from_primitive_count(PrimitiveType, primCount)); wined3d_mutex_unlock(); return hr; @@ -1517,7 +1517,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDE wined3d_mutex_lock(); IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices, + hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 1457bb67041..5a1b75dfef4 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -3603,9 +3603,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, } IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->wineD3DDevice, 0 /* MinVertexIndex */, - VertexCount /* UINT NumVertexIndex */, IndexCount, Indices, WINED3DFMT_R16_UINT, - Vertices, get_flexible_vertex_size(VertexType)); + hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->wineD3DDevice, IndexCount, Indices, + WINED3DFMT_R16_UINT, Vertices, get_flexible_vertex_size(VertexType)); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -4285,8 +4284,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->wineD3DDevice, - 0 /* minIndex */, NumVertices, 0 /* StartIndex */, IndexCount); + hr = IWineD3DDevice_DrawIndexedPrimitive(This->wineD3DDevice, 0 /* StartIndex */, IndexCount); LeaveCriticalSection(&ddraw_cs); return hr; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 58e3b699d95..aab45a0c40d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -9,6 +9,7 @@ * Copyright 2006-2008 Stefan Dösinger for CodeWeavers * Copyright 2006-2008 Henri Verbeet * Copyright 2007 Andrew Riedi + * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -5143,13 +5144,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UI 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, vertex_count, 0/* NumVertices */, StartVertex /* start_idx */, - 0 /* indxSize */, NULL /* indxData */, 0 /* minIndex */); + drawPrimitive(iface, vertex_count, StartVertex /* start_idx */, 0 /* indxSize */, NULL /* indxData */); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, - UINT minIndex, UINT NumVertices, UINT startIndex, UINT index_count) +static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, UINT startIndex, UINT index_count) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; UINT idxStride = 2; @@ -5177,8 +5176,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if } vbo = ((struct wined3d_buffer *) pIB)->buffer_object; - TRACE("(%p) : min %u, vertex count %u, startIdx %u, index count %u\n", - This, minIndex, NumVertices, startIndex, index_count); + TRACE("(%p) : startIndex %u, index count %u.\n", This, startIndex, index_count); if (This->stateBlock->IndexFmt == WINED3DFMT_R16_UINT) { idxStride = 2; @@ -5191,8 +5189,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); } - drawPrimitive(iface, index_count, NumVertices, startIndex, idxStride, - vbo ? NULL : ((struct wined3d_buffer *) pIB)->resource.allocatedMemory, minIndex); + drawPrimitive(iface, index_count, startIndex, idxStride, + vbo ? NULL : ((struct wined3d_buffer *)pIB)->resource.allocatedMemory); return WINED3D_OK; } @@ -5223,8 +5221,7 @@ 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, vertex_count, 0 /* NumVertices */, 0 /* start_idx */, - 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */); + drawPrimitive(iface, vertex_count, 0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */); /* MSDN specifies stream zero settings must be set to NULL */ This->stateBlock->streamStride[0] = 0; @@ -5236,8 +5233,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, UINT MinVertexIndex, - UINT NumVertices, UINT index_count, const void *pIndexData, WINED3DFORMAT IndexDataFormat, +static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, + UINT index_count, const void *pIndexData, WINED3DFORMAT IndexDataFormat, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) { int idxStride; @@ -5245,9 +5242,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice * IWineD3DBuffer *vb; IWineD3DBuffer *ib; - TRACE("(%p) : MinVtxIdx %u, NumVIdx %u, index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u\n", - This, MinVertexIndex, NumVertices, index_count, pIndexData, - IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); + TRACE("(%p) : index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u.\n", + This, index_count, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); if(!This->stateBlock->vertexDecl) { WARN("(%p) : Called without a valid vertex declaration set\n", This); @@ -5275,8 +5271,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice * IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - drawPrimitive(iface, index_count, NumVertices, 0 /* start_idx */, - idxStride, pIndexData, MinVertexIndex); + drawPrimitive(iface, index_count, 0 /* start_idx */, idxStride, pIndexData); /* MSDN specifies stream zero settings and index buffer must be set to NULL */ This->stateBlock->streamSource[0] = NULL; @@ -5306,7 +5301,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); This->stateBlock->baseVertexIndex = 0; This->up_strided = DrawPrimStrideData; - drawPrimitive(iface, vertex_count, 0, 0, 0, NULL, 0); + drawPrimitive(iface, vertex_count, 0, 0, NULL); This->up_strided = NULL; return WINED3D_OK; } @@ -5327,7 +5322,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev This->stateBlock->streamIsUP = TRUE; This->stateBlock->baseVertexIndex = 0; This->up_strided = DrawPrimStrideData; - drawPrimitive(iface, vertex_count, 0 /* numindices */, 0 /* start_idx */, idxSize, pIndexData, 0 /* minindex */); + drawPrimitive(iface, 0 /* numindices */, 0 /* start_idx */, idxSize, pIndexData); This->up_strided = NULL; return WINED3D_OK; } diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 0571e99443e..c3c287e5d62 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -7,6 +7,7 @@ * Copyright 2005 Oliver Stieber * Copyright 2006, 2008 Henri Verbeet * Copyright 2007-2008 Stefan Dösinger for CodeWeavers + * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,26 +35,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw); /* GL locking is done by the caller */ static void drawStridedFast(IWineD3DDevice *iface, GLenum primitive_type, - UINT min_vertex_idx, UINT max_vertex_idx, UINT count, UINT idx_size, - const void *idx_data, UINT start_idx) + UINT count, UINT idx_size, const void *idx_data, UINT start_idx) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; if (idx_size) { - TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, primitive_type, count, min_vertex_idx); + TRACE("(%p) : glElements(%x, %d, ...)\n", This, primitive_type, count); -#if 1 glDrawElements(primitive_type, count, idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (const char *)idx_data + (idx_size * start_idx)); checkGLcall("glDrawElements"); -#else - glDrawRangeElements(primitive_type, min_vertex_idx, max_vertex_idx, count, - idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, - (const char *)idx_data + (idx_size * start_idx)); - checkGLcall("glDrawRangeElements"); -#endif } else { @@ -72,7 +65,7 @@ static void drawStridedFast(IWineD3DDevice *iface, GLenum primitive_type, /* GL locking is done by the caller */ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context *context, const struct wined3d_stream_info *si, UINT NumVertexes, GLenum glPrimType, - const void *idxData, UINT idxSize, UINT minIndex, UINT startIdx) + const void *idxData, UINT idxSize, UINT startIdx) { unsigned int textureNo = 0; const WORD *pIdxBufS = NULL; @@ -423,7 +416,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format /* GL locking is done by the caller */ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream_info *si, UINT numberOfVertices, - GLenum glPrimitiveType, const void *idxData, UINT idxSize, UINT minIndex, UINT startIdx) + GLenum glPrimitiveType, const void *idxData, UINT idxSize, UINT startIdx) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex; @@ -485,7 +478,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream /* GL locking is done by the caller */ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wined3d_stream_info *si, - UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, UINT idxSize, UINT minIndex, + UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, UINT idxSize, UINT startIdx) { UINT numInstances = 0, i; @@ -505,7 +498,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const struct wine return; } - TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, glPrimitiveType, numberOfVertices, minIndex); + TRACE("(%p) : glElements(%x, %d, ...)\n", This, glPrimitiveType, numberOfVertices); /* First, figure out how many instances we have to draw */ for(i = 0; i < MAX_STREAMS; i++) { @@ -576,8 +569,7 @@ static inline void remove_vbos(IWineD3DDeviceImpl *This, struct wined3d_stream_i } /* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertices, - UINT StartIdx, UINT idxSize, const void *idxData, UINT minIndex) +void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT idxSize, const void *idxData) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; @@ -628,8 +620,6 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice const struct wined3d_stream_info *stream_info = &This->strided_streams; struct wined3d_stream_info stridedlcl; - if (!numberOfVertices) numberOfVertices = index_count; - if (!use_vs(This->stateBlock)) { if (!This->strided_streams.position_transformed && context->num_untracked_materials @@ -677,18 +667,17 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice } else { TRACE("Using immediate mode with vertex shaders for half float emulation\n"); } - drawStridedSlowVs(iface, stream_info, index_count, glPrimType, idxData, idxSize, minIndex, StartIdx); + drawStridedSlowVs(iface, stream_info, index_count, glPrimType, idxData, idxSize, StartIdx); } else { drawStridedSlow(iface, context, stream_info, index_count, - glPrimType, idxData, idxSize, minIndex, StartIdx); + glPrimType, idxData, idxSize, StartIdx); } } else if(This->instancedDraw) { /* Instancing emulation with mixing immediate mode and arrays */ drawStridedInstanced(iface, &This->strided_streams, index_count, - glPrimType, idxData, idxSize, minIndex, StartIdx); + glPrimType, idxData, idxSize, StartIdx); } else { - drawStridedFast(iface, glPrimType, minIndex, minIndex + numberOfVertices - 1, - index_count, idxSize, idxData, StartIdx); + drawStridedFast(iface, glPrimType, index_count, idxSize, idxData, StartIdx); } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8d202ca3e34..558c8579803 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1067,8 +1067,7 @@ struct wined3d_stream_info */ /* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertices, - UINT start_idx, UINT idxBytes, const void *idxData, UINT minIndex); +void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT start_idx, UINT idxBytes, const void *idxData); DWORD get_flexible_vertex_size(DWORD d3dvtVertexType); typedef void (WINE_GLAPI *glAttribFunc)(const void *data); diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index ec204332fa1..77e1fb28312 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -3398,8 +3398,6 @@ interface IWineD3DDevice : IWineD3DBase [in] UINT vertex_count ); HRESULT DrawIndexedPrimitive( - [in] UINT min_vertex_idx, - [in] UINT vertex_count, [in] UINT start_idx, [in] UINT index_count ); @@ -3409,8 +3407,6 @@ interface IWineD3DDevice : IWineD3DBase [in] UINT stream_stride ); HRESULT DrawIndexedPrimitiveUP( - [in] UINT min_vertex_idx, - [in] UINT vertex_count, [in] UINT index_count, [in] const void *index_data, [in] WINED3DFORMAT index_data_format,