My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members
Links

Samsung's WebCL Prototype for WebKit

WebCL is a new activity in Khronos that is defining JavaScript bindings to OpenCL. The "WebCL for WebKit" project is an early implementation of WebCL for the open source WebKit browser engine. The design and implementation of WebCL for WebKit are similar to that of WebGL.

New API: We are changing our prototype to be closer to the OpenCL C++ API. The example below is incomplete but indicates the style of this new API.

    var cl = new WebCLComputeContext();

    var context = cl.createContext(device_id, ...);
    var queue = context.createCommandQueue(...);
    var program = context.createProgramWithSource(kernelSource);
    program.buildProgram(...);

    var kernel = program.createKernel(kernelName);
    var input = context.createBuffer(context,  cl.MEM_READ_ONLY,
      Float32Array.BYTES_PER_ELEMENT * count, ...);

    queue.enqueueWriteBuffer(input, true, 0,
      Float32Array.BYTES_PER_ELEMENT * count, data, ...);
    
    kernel.setKernelArgGlobal(0, input);
    queue.enqueueNDRangeKernel(kernel, 1, 0,
      globalWorkSize, localWorkSize, ...);

    queue.finish(...);   

Currently Tested Platforms

  • OS: Mac OSX 10.6 Snow Leopard
  • OS: Mac OSX 10.7 Lion
  • GPU: AMD Radeon HD 6970M
  • GPU: Nvidia GeForce GT 120
  • GPU: Nvidia GeForce GT 330M
  • Browser: Safari
Powered by Google Project Hosting