mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-20 00:56:54 +00:00
refactor: switch to thread_local in Chunk, PistonBaseTile, TheEndPortalTile, Compression
This commit is contained in:
@@ -20,21 +20,18 @@
|
||||
int Chunk::updates = 0;
|
||||
|
||||
#ifdef _LARGE_WORLDS
|
||||
unsigned int Chunk::tlsIdx = TlsAlloc();
|
||||
thread_local uint8_t* Chunk::m_threadTileIds = nullptr;
|
||||
|
||||
void Chunk::CreateNewThreadStorage() {
|
||||
unsigned char* tileIds = new unsigned char[16 * 16 * Level::maxBuildHeight];
|
||||
TlsSetValue(tlsIdx, tileIds);
|
||||
m_threadTileIds = new unsigned char[16 * 16 * Level::maxBuildHeight];
|
||||
}
|
||||
|
||||
void Chunk::ReleaseThreadStorage() {
|
||||
unsigned char* tileIds = (unsigned char*)TlsGetValue(tlsIdx);
|
||||
delete tileIds;
|
||||
delete m_threadTileIds;
|
||||
}
|
||||
|
||||
unsigned char* Chunk::GetTileIdsStorage() {
|
||||
unsigned char* tileIds = (unsigned char*)TlsGetValue(tlsIdx);
|
||||
return tileIds;
|
||||
uint8_t* Chunk::GetTileIdsStorage() {
|
||||
return m_threadTileIds;
|
||||
}
|
||||
#else
|
||||
// 4J Stu - Don't want this when multi-threaded
|
||||
|
||||
Reference in New Issue
Block a user