Skip to content
C++ C JavaScript Python GLSL Makefile HTML
Latest commit 40639a4 Apr 29, 2016 @anthonyliot anthonyliot fix settings
Signed-off-by: Anthony Liot <>



Requirement :



Emscripten Tutorial

Emscripten Fastcomp

Emscripten Fastcomp Clang

WebCL Validator

How To (OSX) :

Step 1 :

install python and nodejs on your system

git clone -b incoming
cd emscripten-fastcomp/tools/
git clone -b incoming clang
build the llvm/clang emscripten-fastcomp using "configure --enable-optimized --disable-assertions --enable-targets=host,js"

git clone
build the llvm/clang webcl-validator
go inside your binary build folder and type :
"install_name_tool -change libclv_standalone.dylib @executable_path/../lib/libclv_standalone.dylib"

Step 2 :

git clone
cd webcl-translator/
git submodule init
git submodule update

Step 3 :

rm ~/.emscripten
rm -rf ~/.emscripten_cache
cd webcl-translator/emscripten
./emcc --help
open ~/.emscripten
set LLVM_ROOT with your llvm path
add LLVM_VALIDATOR_ROOT with your webcl-validator path

Step 4 :

cd YOUR_ROOT_DIRECTORY/webcl-translator
python --help
cd YOUR_ROOT_DIRECTORY/webcl-translator/webcl

General :

webcl-translator is an OpenCL to WebCL converter, it's based on the Emscripten LLVM-to-JavaScript compiler.

Need webkit-webcl from Samsung research for OS X 10.8, you can use my custom version of webkit-webcl for OS X 10.9.

Links to demos, tutorial, patch, etc: Wiki

Automator :

At the top of the repositories, you can use python for update all the samples repositories and automaticaly build all the demos.

You can call python -h for call the automator script help.

Validator :

You can use the webcl-validator with the webcl-translator. You need to add the LLVM_VALIDATOR_ROOT inside the ~/.emscripten config file.

If you build a sample using settings -s CL_VALIDATOR=1, automaticaly all the .cl file embedded are modify by the validator. You can specify parameter to the webcl-validator using -s CL_VAL_PARAM='["-DPARAM1","-DPARAM2"]'.

Settings.js :

The sample are using a Settings.js file who automaticaly add parameter to all the webcl-translator samples. When you launch the translator.html file (and all the html samples files from the samples repositories), you can add some parameter:

&gl=on/off          :   Add a canvas inside the webpage             
&validator=on/off   :   Enable the validator, call val_.....js samples 
&profile=on/off     :   Enable the console profile of the browser   
&export=on/off      :   Open a new page with stack_tracer (if enabled)

Samples repositories :

OSX Samples


David Bucciarelli

OpenCL Book Samples

OpenCL Nvidia Samples

License :

webcl-translator is MIT licensed, see LICENSE.

Something went wrong with that request. Please try again.