Commit 1a1f5ec6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Cleanup drawStridedFast().

Remove some uncessary code and use more descriptive parameter names. Note that max_vertex_idx isn't the same as "minIndex + calculatedNumberOfindices - 1" but rather "minIndex + numberOfVertices - 1". calculatedNumberOfindices just specifies the number of vertices that's drawn, while numberOfVertices specifies the range of vertices that's drawn.
parent d852ac0b
......@@ -253,33 +253,35 @@ void primitiveDeclarationConvertToStridedData(
}
}
static void drawStridedFast(IWineD3DDevice *iface, UINT numberOfVertices, GLenum glPrimitiveType,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx)
static void drawStridedFast(IWineD3DDevice *iface, GLenum primitive_type,
UINT min_vertex_idx, UINT max_vertex_idx, UINT count, short idx_size,
const void *idx_data, UINT start_idx)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
if (idxSize != 0 /* This crashes sometimes!*/) {
TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, glPrimitiveType, numberOfVertices, minIndex);
idxData = idxData == (void *)-1 ? NULL : idxData;
if (idx_size)
{
TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, primitive_type, count, min_vertex_idx);
#if 1
glDrawElements(glPrimitiveType, numberOfVertices, idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
glDrawElements(primitive_type, count,
idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
(const char *)idx_data + (idx_size * start_idx));
checkGLcall("glDrawElements");
#else /* using drawRangeElements may be faster */
glDrawRangeElements(glPrimitiveType, minIndex, minIndex + numberOfVertices - 1, numberOfVertices,
idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
#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
{
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, primitive_type, start_idx, count);
} else {
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startIdx, numberOfVertices);
glDrawArrays(glPrimitiveType, startIdx, numberOfVertices);
glDrawArrays(primitive_type, start_idx, count);
checkGLcall("glDrawArrays");
}
return;
}
/*
......@@ -913,8 +915,8 @@ void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx);
} else {
drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx);
drawStridedFast(iface, glPrimType, minIndex, minIndex + numberOfVertices - 1,
calculatedNumberOfindices, idxSize, idxData, StartIdx);
}
}
......
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