webcl-translator icon indicating copy to clipboard operation
webcl-translator copied to clipboard

Wrong code is generated if '--closure 1' is given

Open hujiajie opened this issue 9 years ago • 1 comments

I'm trying to minify the generated WebCL program by passing the '--closure 1' option to emscripten. However, the closure compiler can't recognize WebCL APIs and will replace them with shorter names. To avoid this, WebCL APIs should be declared as externs. One possible solution is to add the declarations to this file. The closure compiler cannot handle properties defined with Object.defineProperty, either. As an example, Object.defineProperty(_kernel, "sig", { value : CL.cl_kernels_sig[_name],writable : false }); adds property sig to _kernel, but the closure compiler will translate the following _kernel.sig in library_opencl.js to something like k.s. As a workaround, change _kernel.sig to _kernel["sig"] may work.

hujiajie avatar Oct 09 '14 14:10 hujiajie