refactor: Tesselator thread-local storage

This commit is contained in:
Tropical 2026-03-25 12:43:41 -05:00
parent d6848fa578
commit a82d76ca46
2 changed files with 4 additions and 5 deletions

View file

@ -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

View file

@ -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();