Turning Mesa Into JavaScript For The Web?
Besides the recent talk about using Gallium3D's LLVMpipe for Mozilla Firefox, there's another interesting technical discussion happening now about using Mesa on the web to emulate the full OpenGL API using the WebGL API.
Alon Zakai is one of the developers behind Emscripten and started the latest Mesa-for-the-web talk. Emscripten is the interesting project I talked about last year for generating JavaScript from LLVM bit-code. If the code can be lowered-down via LLVM, it can be converted to JavaScript that can be executed in the browser. C/C++ can be easily lowered-down via LLVM and then executed in the browser. Emscripten developers have already used this means of translation to bring Python, Poppler, and other large projects into becoming large JavaScript projects on the web.
The Emscripten developers latest effort has been "to be able to compile OpenGL games from desktop so that they work on WebGL on the web." Quite interesting. The problem that the open-source developers are facing at the moment is the lack of the full OpenGL API on the web, but rather they have just the WebGL API to poke. The Emscripten developers therefore hope using Mesa in some manner may come to their rescue for being able to expose the full OpenGL API while internally it's using the WebGL interfaces. Mesa is largely written in C (and can be built under LLVM/Clang already) so in theory it might possibly work to use Emscripten to convert portions of the code-base into JavaScript.
The developers working on this so far have been able to implement a portion of the OpenGL ES 2.0 API and then brought the es2gears demo to the web. WebGL effectively provides a sub-set of OpenGL ES 2.0 functionality so right now that much isn't a huge challenge.
The discussion about the possibilities for Mesa and Emscripten can be explored further via this mailing list thread, but at the moment there isn't any definitive outcome.
Alon Zakai is one of the developers behind Emscripten and started the latest Mesa-for-the-web talk. Emscripten is the interesting project I talked about last year for generating JavaScript from LLVM bit-code. If the code can be lowered-down via LLVM, it can be converted to JavaScript that can be executed in the browser. C/C++ can be easily lowered-down via LLVM and then executed in the browser. Emscripten developers have already used this means of translation to bring Python, Poppler, and other large projects into becoming large JavaScript projects on the web.
The Emscripten developers latest effort has been "to be able to compile OpenGL games from desktop so that they work on WebGL on the web." Quite interesting. The problem that the open-source developers are facing at the moment is the lack of the full OpenGL API on the web, but rather they have just the WebGL API to poke. The Emscripten developers therefore hope using Mesa in some manner may come to their rescue for being able to expose the full OpenGL API while internally it's using the WebGL interfaces. Mesa is largely written in C (and can be built under LLVM/Clang already) so in theory it might possibly work to use Emscripten to convert portions of the code-base into JavaScript.
The developers working on this so far have been able to implement a portion of the OpenGL ES 2.0 API and then brought the es2gears demo to the web. WebGL effectively provides a sub-set of OpenGL ES 2.0 functionality so right now that much isn't a huge challenge.
The discussion about the possibilities for Mesa and Emscripten can be explored further via this mailing list thread, but at the moment there isn't any definitive outcome.
13 Comments