0.2.0-dev Download ZIP
32 lines ·1.0 KB Raw
| 1 | diff --git a/thirdparty/embree/common/sys/sysinfo.cpp b/thirdparty/embree/common/sys/sysinfo.cpp |
| 2 | index 5f375cd95c..3c23fb1610 100644 |
| 3 | --- a/thirdparty/embree/common/sys/sysinfo.cpp |
| 4 | +++ b/thirdparty/embree/common/sys/sysinfo.cpp |
| 5 | @@ -659,6 +659,10 @@ namespace embree |
| 6 | |
| 7 | #if defined(__EMSCRIPTEN__) |
| 8 | #include <emscripten.h> |
| 9 | + |
| 10 | +extern "C" { |
| 11 | +extern int godot_js_os_hw_concurrency_get(); |
| 12 | +} |
| 13 | #endif |
| 14 | |
| 15 | namespace embree |
| 16 | @@ -672,6 +676,8 @@ namespace embree |
| 17 | nThreads = sysconf(_SC_NPROCESSORS_ONLN); // does not work in Linux LXC container |
| 18 | assert(nThreads); |
| 19 | #elif defined(__EMSCRIPTEN__) |
| 20 | + nThreads = godot_js_os_hw_concurrency_get(); |
| 21 | +#if 0 |
| 22 | // WebAssembly supports pthreads, but not pthread_getaffinity_np. Get the number of logical |
| 23 | // threads from the browser or Node.js using JavaScript. |
| 24 | nThreads = MAIN_THREAD_EM_ASM_INT({ |
| 25 | @@ -687,6 +693,7 @@ namespace embree |
| 26 | return 1; |
| 27 | } |
| 28 | }); |
| 29 | +#endif |
| 30 | #else |
| 31 | cpu_set_t set; |
| 32 | if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0) |