mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/GabsPuNs-MinecraftConsoles.git
synced 2026-06-04 08:17:25 +00:00
Some fixes and improvements
This commit is contained in:
@@ -688,6 +688,45 @@ void LevelRenderer::resortChunks(int xc, int yc, int zc)
|
||||
if (zz < zMinChunk) zMinChunk = zz;
|
||||
if (zz > zMaxChunk) zMaxChunk = zz;
|
||||
|
||||
#ifdef __AVX__ //SSE4.2
|
||||
__m128i vYMin = _mm_set1_epi32(yMinChunk);
|
||||
__m128i vYMax = _mm_set1_epi32(yMaxChunk);
|
||||
__m128i vChunkSize = _mm_set1_epi32(CHUNK_SIZE);
|
||||
__m128i vStep = _mm_set_epi32(3, 2, 1, 0);
|
||||
|
||||
for (int y = 0; y <= yChunks - 4; y += 4)
|
||||
{
|
||||
__m128i vCurrentY = _mm_add_epi32(_mm_set1_epi32(y), vStep);
|
||||
__m128i vYY = _mm_mullo_epi32(vCurrentY, vChunkSize);
|
||||
|
||||
vYMin = _mm_min_epi32(vYMin, vYY);
|
||||
vYMax = _mm_max_epi32(vYMax, vYY);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int finalYY = (y + i) * CHUNK_SIZE;
|
||||
chunks[playerIndex][(z * yChunks + (y + i)) * xChunks + x].chunk->setPos(xx, finalYY, zz);
|
||||
}
|
||||
}
|
||||
|
||||
alignas(16) int resMin[4], resMax[4];
|
||||
_mm_store_si128((__m128i*)resMin, vYMin);
|
||||
_mm_store_si128((__m128i*)resMax, vYMax);
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if (resMin[i] < yMinChunk) yMinChunk = resMin[i];
|
||||
if (resMax[i] > yMaxChunk) yMaxChunk = resMax[i];
|
||||
}
|
||||
|
||||
for (int y = 0; y < yChunks; y++)
|
||||
{
|
||||
int yy = y * CHUNK_SIZE;
|
||||
if (yy < yMinChunk) yMinChunk = yy;
|
||||
if (yy > yMaxChunk) yMaxChunk = yy;
|
||||
chunks[playerIndex][(z * yChunks + y) * xChunks + x].chunk->setPos(xx, yy, zz);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (int y = 0; y < yChunks; y++)
|
||||
{
|
||||
int yy = y * CHUNK_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user