The following code
int main()
{
if (glewInit() != GLEW_OK) {
std::cout << "No glew" << std::endl;
return 1;
}
if (glfwInit() != GLFW_TRUE) {
std::cout << "No glfw" << std::endl;
return 2;
}
auto w = glfwCreateWindow(100, 100, "Foo", 0, 0);
glfwMakeContextCurrent(w);
GLuint bufId;
glGenBuffers(1, &bufId);
glBindBuffer(GL_ARRAY_BUFFER, bufId);
glBufferData(GL_ARRAY_BUFFER, 256, nullptr, GL_STATIC_DRAW);
return 0;
}
being compiled with flags -s USE_PTHREADS=1 -s USE_GLFW=3 -s USE_WEBGL2=1 crashes with Assertion failed: target_thread, at: /path/to/emsdk/emscripten/1.38.31/system/lib/pthread/library_pthread.c,355,emscripten_async_queue_call_on_thread on glBufferData call.
It works correctly if we comment out glBufferData or build the code without threading support. Threading and shared buffers in browser are enabled and a minimal example with ClearColor() and Clear() work correctly even from a worker thread.
Also crashes with webgl1.
The following code
being compiled with flags
-s USE_PTHREADS=1 -s USE_GLFW=3 -s USE_WEBGL2=1crashes withAssertion failed: target_thread, at: /path/to/emsdk/emscripten/1.38.31/system/lib/pthread/library_pthread.c,355,emscripten_async_queue_call_on_threadonglBufferDatacall.It works correctly if we comment out
glBufferDataor build the code without threading support. Threading and shared buffers in browser are enabled and a minimal example withClearColor()andClear()work correctly even from a worker thread.Also crashes with webgl1.