diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index 35e472a45..25d9014b2 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -24,15 +24,14 @@ int normal; */ -unsigned int Tesselator::tlsIdx = TlsAlloc(); +thread_local Tesselator* Tesselator::m_thread_instance = nullptr; Tesselator* Tesselator::getInstance() { - return (Tesselator*)TlsGetValue(tlsIdx); + return m_thread_instance; } void Tesselator::CreateNewThreadStorage(int bytes) { - Tesselator* instance = new Tesselator(bytes / 4); - TlsSetValue(tlsIdx, instance); + Tesselator::m_thread_instance = new Tesselator(bytes / 4); } // she tessalate my vertices till i render diff --git a/Minecraft.Client/Rendering/Tesselator.h b/Minecraft.Client/Rendering/Tesselator.h index 02d43a12c..bd9edecc2 100644 --- a/Minecraft.Client/Rendering/Tesselator.h +++ b/Minecraft.Client/Rendering/Tesselator.h @@ -41,7 +41,7 @@ public: static void CreateNewThreadStorage(int bytes); private: - static unsigned int tlsIdx; + static thread_local Tesselator* m_thread_instance; public: static Tesselator* getInstance();