From cd234013ce9e8a0d2045f8c07248221e022d5e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 21 May 2015 16:50:14 -0700 Subject: [PATCH] Fixed mach TLS issue. --- src/bgfx.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 235e3978..4970df5c 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -919,7 +919,10 @@ namespace bgfx // When bgfx::renderFrame is called before init render thread // should not be created. BX_TRACE("Application called bgfx::renderFrame directly, not creating render thread."); - m_singleThreaded = ~BGFX_MAIN_THREAD_MAGIC == s_threadIndex; + m_singleThreaded = true + && !BX_ENABLED(BX_PLATFORM_OSX || BX_PLATFORM_IOS) + && ~BGFX_MAIN_THREAD_MAGIC == s_threadIndex + ; } else { @@ -932,6 +935,8 @@ namespace bgfx m_singleThreaded = true; #endif // BGFX_CONFIG_MULTITHREADED + BX_TRACE("Running in %s-threaded mode", m_singleThreaded ? "single" : "multi"); + s_threadIndex = BGFX_MAIN_THREAD_MAGIC; for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii)