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( ...@@ -253,33 +253,35 @@ void primitiveDeclarationConvertToStridedData(
} }
} }
static void drawStridedFast(IWineD3DDevice *iface, UINT numberOfVertices, GLenum glPrimitiveType, static void drawStridedFast(IWineD3DDevice *iface, GLenum primitive_type,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) UINT min_vertex_idx, UINT max_vertex_idx, UINT count, short idx_size,
const void *idx_data, UINT start_idx)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
if (idxSize != 0 /* This crashes sometimes!*/) { if (idx_size)
TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, glPrimitiveType, numberOfVertices, minIndex); {
idxData = idxData == (void *)-1 ? NULL : idxData; TRACE("(%p) : glElements(%x, %d, %d, ...)\n", This, primitive_type, count, min_vertex_idx);
#if 1 #if 1
glDrawElements(glPrimitiveType, numberOfVertices, idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, glDrawElements(primitive_type, count,
(const char *)idxData+(idxSize * startIdx)); idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
(const char *)idx_data + (idx_size * start_idx));
checkGLcall("glDrawElements"); checkGLcall("glDrawElements");
#else /* using drawRangeElements may be faster */ #else
glDrawRangeElements(primitive_type, min_vertex_idx, max_vertex_idx, count,
glDrawRangeElements(glPrimitiveType, minIndex, minIndex + numberOfVertices - 1, numberOfVertices, idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (const char *)idx_data + (idx_size * start_idx));
(const char *)idxData+(idxSize * startIdx));
checkGLcall("glDrawRangeElements"); checkGLcall("glDrawRangeElements");
#endif #endif
}
else
{
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, primitive_type, start_idx, count);
} else { glDrawArrays(primitive_type, start_idx, count);
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startIdx, numberOfVertices);
glDrawArrays(glPrimitiveType, startIdx, numberOfVertices);
checkGLcall("glDrawArrays"); checkGLcall("glDrawArrays");
} }
return;
} }
/* /*
...@@ -913,8 +915,8 @@ void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives, ...@@ -913,8 +915,8 @@ void drawPrimitive(IWineD3DDevice *iface, int PrimitiveType, long NumPrimitives,
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType, drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx); idxData, idxSize, minIndex, StartIdx);
} else { } else {
drawStridedFast(iface, calculatedNumberOfindices, glPrimType, drawStridedFast(iface, glPrimType, minIndex, minIndex + numberOfVertices - 1,
idxData, idxSize, minIndex, StartIdx); 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