// Call this upon thread startup. Current *AllocateCurrent() { ASSERT(currentTLS != TLS_INVALID_INDEX); if (currentTLS == TLS_INVALID_INDEX) { return NULL; } Current *current = new Current(); current->context = NULL; current->display = NULL; if (!SetTLSValue(currentTLS, current)) { ERR("Could not set thread local storage."); return NULL; } return current; }
Current *AllocateCurrent() { ASSERT(currentTLS != TLS_OUT_OF_INDEXES); if (currentTLS == TLS_OUT_OF_INDEXES) { return NULL; } Current *current = new Current(); current->error = EGL_SUCCESS; current->API = EGL_OPENGL_ES_API; current->display = EGL_NO_DISPLAY; current->drawSurface = EGL_NO_SURFACE; current->readSurface = EGL_NO_SURFACE; if (!SetTLSValue(currentTLS, current)) { ERR("Could not set thread local storage."); return NULL; } return current; }
void DeallocateCurrent() { Current *current = reinterpret_cast<Current*>(GetTLSValue(currentTLS)); SafeDelete(current); SetTLSValue(currentTLS, NULL); }
void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator) { assert(PoolIndex != TLS_INVALID_INDEX); SetTLSValue(PoolIndex, poolAllocator); }