Slight cleanup. Also, index arrays are always non-strided, so now using vectorization.

This commit is contained in:
Shyotl
2011-08-18 00:33:59 -05:00
parent 210e9ed78b
commit d2ae02a855
3 changed files with 25 additions and 8 deletions

View File

@@ -1157,13 +1157,29 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
// INDICES
if (full_rebuild)
{
mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex);
for (U32 i = 0; i < (U32) num_indices; i++)
mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range);
__m128i* dst = (__m128i*) indicesp.get();
__m128i* src = (__m128i*) vf.mIndices;
__m128i offset = _mm_set1_epi16(index_offset);
S32 end = num_indices/8;
for (S32 i = 0; i < end; i++)
{
indicesp[i] = vf.mIndices[i] + index_offset;
__m128i res = _mm_add_epi16(src[i], offset);
_mm_storeu_si128(dst+i, res);
}
//mVertexBuffer->setBuffer(0);
for (S32 i = end*8; i < num_indices; ++i)
{
indicesp[i] = vf.mIndices[i]+index_offset;
}
if (map_range)
{
mVertexBuffer->setBuffer(0);
}
}
LLMatrix4a mat_normal;