Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-webcl

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-webcl - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

.npmignore

59

examples/apple/qjulia/qjulia.js

@@ -42,3 +42,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

requestAnimationFrame = document.requestAnimationFrame;
var cl = new WebCL();
var use_gpu=true;

@@ -117,3 +116,3 @@

var err=this.setupGraphics(canvas);
if(err != cl.SUCCESS)
if(err != WebCL.SUCCESS)
return err;

@@ -126,3 +125,3 @@ this.initAntTweakBar(canvas);

var image_support = ComputeDeviceId.getInfo(cl.DEVICE_IMAGE_SUPPORT);
var image_support = ComputeDeviceId.getInfo(WebCL.DEVICE_IMAGE_SUPPORT);
if (!image_support) {

@@ -134,7 +133,7 @@ printf("Unable to query device for image support");

log("Application requires images: Images not supported on this device.");
return cl.IMAGE_FORMAT_NOT_SUPPORTED;
return WebCL.IMAGE_FORMAT_NOT_SUPPORTED;
}
err = this.setupComputeKernel();
if (err != cl.SUCCESS)
if (err != WebCL.SUCCESS)
{

@@ -146,3 +145,3 @@ log("Failed to setup compute kernel! Error " + err);

err = this.createComputeResult();
if(err != cl.SUCCESS)
if(err != WebCL.SUCCESS)
{

@@ -153,3 +152,3 @@ log ("Failed to create compute result! Error " + err);

return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -320,3 +319,3 @@

gl.activeTexture(gl.TEXTURE0);
return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -359,7 +358,7 @@ renderTexture: function( pvData )

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
var platform=platformList[0];
ComputeDeviceType = device_type ? cl.DEVICE_TYPE_GPU : cl.DEVICE_TYPE_CPU;
ComputeContext = cl.createContext({
ComputeDeviceType = device_type ? WebCL.DEVICE_TYPE_GPU : WebCL.DEVICE_TYPE_CPU;
ComputeContext = WebCL.createContext({
deviceType: ComputeDeviceType,

@@ -369,3 +368,3 @@ platform: platform,

var device_ids = ComputeContext.getInfo(cl.CONTEXT_DEVICES);
var device_ids = ComputeContext.getInfo(WebCL.CONTEXT_DEVICES);
if(!device_ids)

@@ -380,3 +379,3 @@ {

{
device_type=device_ids[i].getInfo(cl.DEVICE_TYPE);
device_type=device_ids[i].getInfo(WebCL.DEVICE_TYPE);
if(device_type == ComputeDeviceType)

@@ -407,8 +406,8 @@ {

//
var vendor_name = ComputeDeviceId.getInfo(cl.DEVICE_VENDOR);
var device_name = ComputeDeviceId.getInfo(cl.DEVICE_NAME);
var vendor_name = ComputeDeviceId.getInfo(WebCL.DEVICE_VENDOR);
var device_name = ComputeDeviceId.getInfo(WebCL.DEVICE_NAME);
log("Connecting to "+vendor_name+" "+device_name);
return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -452,3 +451,3 @@ setupComputeKernel:function() {

alert("Error: Failed to build program executable!\n"+
ComputeProgram.getBuildInfo(ComputeDeviceId, cl.PROGRAM_BUILD_LOG));
ComputeProgram.getBuildInfo(ComputeDeviceId, WebCL.PROGRAM_BUILD_LOG));
return -1;

@@ -469,3 +468,3 @@ }

//
MaxWorkGroupSize = ComputeKernel.getWorkGroupInfo(ComputeDeviceId, cl.KERNEL_WORK_GROUP_SIZE);
MaxWorkGroupSize = ComputeKernel.getWorkGroupInfo(ComputeDeviceId, WebCL.KERNEL_WORK_GROUP_SIZE);

@@ -478,3 +477,3 @@ log("MaxWorkGroupSize: " + MaxWorkGroupSize);

log("WorkGroupSize: " + WorkGroupSize);
return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -486,3 +485,3 @@ createComputeResult: function() {

log("Allocating compute result image in device memory...");
ComputeImage = ComputeContext.createFromGLTexture2D(cl.MEM_WRITE_ONLY, TextureTarget, 0, TextureId);
ComputeImage = ComputeContext.createFromGLTexture(WebCL.MEM_WRITE_ONLY, TextureTarget, 0, TextureId);
if (!ComputeImage)

@@ -496,3 +495,3 @@ {

log("Allocating compute result buffer in device memory...");
ComputeResult = ComputeContext.createBuffer(cl.MEM_WRITE_ONLY, TextureTypeSize * 4 * TextureWidth * TextureHeight);
ComputeResult = ComputeContext.createBuffer(WebCL.MEM_WRITE_ONLY, TextureTypeSize * 4 * TextureWidth * TextureHeight);
if (!ComputeResult)

@@ -503,3 +502,3 @@ {

}
return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -560,3 +559,3 @@ cleanup: function()

Height=newHeight;
if(this.initialize(ComputeDeviceType == cl.DEVICE_TYPE_GPU) != cl.SUCCESS)
if(this.initialize(ComputeDeviceType == WebCL.DEVICE_TYPE_GPU) != WebCL.SUCCESS)
this.shutdown();

@@ -595,3 +594,3 @@ }

return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -740,3 +739,3 @@ reshape: function (evt)

if(!ComputeKernel || !ComputeResult)
return cl.SUCCESS;
return WebCL.SUCCESS;

@@ -748,5 +747,5 @@ if(Animated || Update)

ComputeKernel.setArg(0, ComputeResult);
ComputeKernel.setArg(1, MuC, cl.type.FLOAT | cl.type.VEC4);
ComputeKernel.setArg(2, ColorC, cl.type.FLOAT | cl.type.VEC4);
ComputeKernel.setArg(3, Epsilon, cl.type.FLOAT);
ComputeKernel.setArg(1, MuC, WebCL.type.FLOAT | WebCL.type.VEC4);
ComputeKernel.setArg(2, ColorC, WebCL.type.FLOAT | WebCL.type.VEC4);
ComputeKernel.setArg(3, Epsilon, WebCL.type.FLOAT);
} catch (err) {

@@ -806,3 +805,3 @@ alert("Failed to set kernel args! " + err);

ComputeCommands.finish();
return cl.SUCCESS;
return WebCL.SUCCESS;
},

@@ -846,3 +845,3 @@

clgl=new CLGL();
if(clgl.initialize(use_gpu)==cl.SUCCESS) {
if(clgl.initialize(use_gpu)==WebCL.SUCCESS) {
function update() {

@@ -849,0 +848,0 @@ clgl.display();

@@ -37,6 +37,4 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl=new WebCL();
//First check if the webcl extension is installed at all
if (cl == undefined) {
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. " +

@@ -79,14 +77,14 @@ "Make sure that you have the WebCL extension installed.");

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
var platform=platformList[0];
//Query the set of GPU devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_ALL);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_ALL);
log(" # of Devices Available = "+devices.length);
var uiTargetDevice = clu.clamp(uiTargetDevice, 0, (devices.length - 1));
var device=devices[uiTargetDevice];
log(" Using Device "+ uiTargetDevice+": "+device.getInfo(cl.DEVICE_NAME));
log(" Using Device "+ uiTargetDevice+": "+device.getInfo(WebCL.DEVICE_NAME));
var hasImageSupport=device.getInfo(cl.DEVICE_IMAGE_SUPPORT);
if(hasImageSupport != cl.TRUE) {
var hasImageSupport=device.getInfo(WebCL.DEVICE_IMAGE_SUPPORT);
if(hasImageSupport != WebCL.TRUE) {
log("No image support");

@@ -96,7 +94,7 @@ return;

var numComputeUnits=device.getInfo(cl.DEVICE_MAX_COMPUTE_UNITS);
var numComputeUnits=device.getInfo(WebCL.DEVICE_MAX_COMPUTE_UNITS);
log(' # of Compute Units = '+numComputeUnits);
log(' createContext...');
context=cl.createContext({
context=WebCL.createContext({
devices: device,

@@ -111,4 +109,4 @@ platform: platform

var InputFormat= {
order : cl.RGBA,
data_type : cl.UNSIGNED_INT8,
order : WebCL.RGBA,
data_type : WebCL.UNSIGNED_INT8,
size : [ image.width, image.height ],

@@ -119,9 +117,9 @@ rowPitch : image.pitch

//2D Image (Texture) on device
cmDevBufIn = context.createImage(cl.MEM_READ_ONLY | cl.MEM_USE_HOST_PTR, InputFormat, image.buffer);
cmDevBufIn = context.createImage(WebCL.MEM_READ_ONLY | WebCL.MEM_USE_HOST_PTR, InputFormat, image.buffer);
RowSampler = context.createSampler(false, cl.ADDRESS_CLAMP, cl.FILTER_NEAREST);
RowSampler = context.createSampler(false, WebCL.ADDRESS_CLAMP, WebCL.FILTER_NEAREST);
// Allocate the OpenCL intermediate and result buffer memory objects on the device GMEM
cmDevBufTemp = context.createBuffer(cl.MEM_READ_WRITE, szBuffBytes);
cmDevBufOut = context.createBuffer(cl.MEM_WRITE_ONLY, szBuffBytes);
cmDevBufTemp = context.createBuffer(WebCL.MEM_READ_WRITE, szBuffBytes);
cmDevBufOut = context.createBuffer(WebCL.MEM_WRITE_ONLY, szBuffBytes);

@@ -152,3 +150,3 @@ //Create the program

var uiOutput=new Uint8Array(szBuffBytes);
queue.enqueueReadBuffer(cmDevBufOut, cl.TRUE, 0, szBuffBytes, uiOutput);
queue.enqueueReadBuffer(cmDevBufOut, WebCL.TRUE, 0, szBuffBytes, uiOutput);

@@ -168,6 +166,6 @@ // PNG uses 32-bit images, JPG can only work on 24-bit images

ckBoxRowsTex.setArg(2, RowSampler);
ckBoxRowsTex.setArg(3, width, cl.type.UINT);
ckBoxRowsTex.setArg(4, height, cl.type.UINT);
ckBoxRowsTex.setArg(5, r, cl.type.INT);
ckBoxRowsTex.setArg(6, fScale, cl.type.FLOAT);
ckBoxRowsTex.setArg(3, width, WebCL.type.UINT);
ckBoxRowsTex.setArg(4, height, WebCL.type.UINT);
ckBoxRowsTex.setArg(5, r, WebCL.type.INT);
ckBoxRowsTex.setArg(6, fScale, WebCL.type.FLOAT);

@@ -177,6 +175,6 @@ // Set the Argument values for the column kernel

ckBoxColumns.setArg(1, cmDevBufOut);
ckBoxColumns.setArg(2, width, cl.type.UINT);
ckBoxColumns.setArg(3, height, cl.type.UINT);
ckBoxColumns.setArg(4, r, cl.type.INT);
ckBoxColumns.setArg(5, fScale, cl.type.FLOAT);
ckBoxColumns.setArg(2, width, WebCL.type.UINT);
ckBoxColumns.setArg(3, height, WebCL.type.UINT);
ckBoxColumns.setArg(4, r, WebCL.type.INT);
ckBoxColumns.setArg(5, fScale, WebCL.type.FLOAT);
}

@@ -196,3 +194,3 @@

log('enqueue image: origin='+szTexOrigin+", region="+szTexRegion);
queue.enqueueWriteImage(cmDevBufIn, cl.TRUE, szTexOrigin, szTexRegion, 0, 0, image.buffer);
queue.enqueueWriteImage(cmDevBufIn, WebCL.TRUE, szTexOrigin, szTexRegion, 0, 0, image.buffer);

@@ -199,0 +197,0 @@ // Set global and local work sizes for row kernel

@@ -42,3 +42,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var use_gpu = false;
var use_gpu = true;
var image;

@@ -51,3 +51,2 @@

// cl stuff
var cl = new WebCL();
var /* cl_context */ ComputeContext;

@@ -93,3 +92,3 @@ var /* cl_command_queue */ ComputeCommands;

var err = init_gl(canvas);
if (err != cl.SUCCESS)
if (err != WebCL.SUCCESS)
return err;

@@ -110,3 +109,3 @@

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -140,3 +139,3 @@

// Create OpenCL representation of OpenGL PBO
ComputePBO = ComputeContext.createFromGLBuffer(cl.MEM_WRITE_ONLY, pbo);
ComputePBO = ComputeContext.createFromGLBuffer(WebCL.MEM_WRITE_ONLY, pbo);
if (!ComputePBO) {

@@ -302,3 +301,3 @@ alert("Error: Failed to create CL PBO buffer");

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -337,10 +336,10 @@

log('init CL');
ComputeDeviceType = device_type ? cl.DEVICE_TYPE_GPU : cl.DEVICE_TYPE_DEFAULT;
ComputeDeviceType = device_type ? WebCL.DEVICE_TYPE_GPU : WebCL.DEVICE_TYPE_DEFAULT;
// Pick platform
var platformList = cl.getPlatforms();
var platformList = WebCL.getPlatforms();
var platform = platformList[0];
// create the OpenCL context
ComputeContext = cl.createContext({
ComputeContext = WebCL.createContext({
deviceType: ComputeDeviceType,

@@ -350,3 +349,3 @@ shareGroup: gl,

var device_ids = ComputeContext.getInfo(cl.CONTEXT_DEVICES);
var device_ids = ComputeContext.getInfo(WebCL.CONTEXT_DEVICES);
if (!device_ids) {

@@ -359,3 +358,3 @@ alert("Error: Failed to retrieve compute devices for context!");

for(var i=0,l=device_ids.length;i<l;++i ) {
device_type = device_ids[i].getInfo(cl.DEVICE_TYPE);
device_type = device_ids[i].getInfo(WebCL.DEVICE_TYPE);
if (device_type == ComputeDeviceType) {

@@ -383,14 +382,14 @@ ComputeDeviceId = device_ids[i];

//
var vendor_name = ComputeDeviceId.getInfo(cl.DEVICE_VENDOR);
var device_name = ComputeDeviceId.getInfo(cl.DEVICE_NAME);
var vendor_name = ComputeDeviceId.getInfo(WebCL.DEVICE_VENDOR);
var device_name = ComputeDeviceId.getInfo(WebCL.DEVICE_NAME);
log("Connecting to " + vendor_name + " " + device_name);
if (!ComputeDeviceId.getInfo(cl.DEVICE_IMAGE_SUPPORT)) {
if (!ComputeDeviceId.getInfo(WebCL.DEVICE_IMAGE_SUPPORT)) {
log("Application requires images: Images not supported on this device.");
return cl.IMAGE_FORMAT_NOT_SUPPORTED;
return WebCL.IMAGE_FORMAT_NOT_SUPPORTED;
}
err = init_cl_buffers();
if (err != cl.SUCCESS) {
if (err != WebCL.SUCCESS) {
log("Failed to create compute result! Error " + err);

@@ -401,3 +400,3 @@ return err;

err = init_cl_kernels();
if (err != cl.SUCCESS) {
if (err != WebCL.SUCCESS) {
log("Failed to setup compute kernel! Error " + err);

@@ -407,3 +406,3 @@ return err;

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -438,3 +437,3 @@

alert("Error: Failed to build program executable!\n"
+ ComputeProgram.getBuildInfo(ComputeDeviceId, cl.PROGRAM_BUILD_LOG));
+ ComputeProgram.getBuildInfo(ComputeDeviceId, WebCL.PROGRAM_BUILD_LOG));
return -1;

@@ -455,3 +454,3 @@ }

}
return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -468,7 +467,7 @@

ckBoxRowsTex.setArg(1, ComputeBufTemp);
ckBoxRowsTex.setArg(2, RowSampler, cl.type.SAMPLER);
ckBoxRowsTex.setArg(3, image_width, cl.type.INT);
ckBoxRowsTex.setArg(4, image_height, cl.type.INT);
ckBoxRowsTex.setArg(5, r, cl.type.INT);
ckBoxRowsTex.setArg(6, scale, cl.type.FLOAT);
ckBoxRowsTex.setArg(2, RowSampler, WebCL.type.SAMPLER);
ckBoxRowsTex.setArg(3, image_width, WebCL.type.INT);
ckBoxRowsTex.setArg(4, image_height, WebCL.type.INT);
ckBoxRowsTex.setArg(5, r, WebCL.type.INT);
ckBoxRowsTex.setArg(6, scale, WebCL.type.FLOAT);
} catch (err) {

@@ -483,6 +482,6 @@ alert("Failed to set row kernel args! " + err);

ckBoxColumns.setArg(1, ComputePBO);
ckBoxColumns.setArg(2, image_width, cl.type.INT);
ckBoxColumns.setArg(3, image_height, cl.type.INT);
ckBoxColumns.setArg(4, r, cl.type.INT);
ckBoxColumns.setArg(5, scale, cl.type.FLOAT);
ckBoxColumns.setArg(2, image_width, WebCL.type.INT);
ckBoxColumns.setArg(3, image_height, WebCL.type.INT);
ckBoxColumns.setArg(4, r, WebCL.type.INT);
ckBoxColumns.setArg(5, scale, WebCL.type.FLOAT);
} catch (err) {

@@ -496,6 +495,6 @@ alert("Failed to set column kernel args! " + err);

MaxWorkGroupSize = ckBoxRowsTex.getWorkGroupInfo(ComputeDeviceId,
cl.KERNEL_WORK_GROUP_SIZE);
WebCL.KERNEL_WORK_GROUP_SIZE);
log(" MaxWorkGroupSize: " + MaxWorkGroupSize);
return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -508,8 +507,8 @@

var InputFormat = {
order : cl.RGBA,
data_type : cl.UNSIGNED_INT8,
order : WebCL.RGBA,
data_type : WebCL.UNSIGNED_INT8,
size: [ image.width, image.height ],
rowPitch: image.pitch
};
ComputeTexture = ComputeContext.createImage(cl.MEM_READ_ONLY | cl.MEM_USE_HOST_PTR, InputFormat, image);
ComputeTexture = ComputeContext.createImage(WebCL.MEM_READ_ONLY | WebCL.MEM_USE_HOST_PTR, InputFormat, image);
if (!ComputeTexture) {

@@ -520,3 +519,3 @@ alert("Error: Failed to create a Image2D on device");

RowSampler = ComputeContext.createSampler(false, cl.ADDRESS_CLAMP, cl.FILTER_NEAREST);
RowSampler = ComputeContext.createSampler(false, WebCL.ADDRESS_CLAMP, WebCL.FILTER_NEAREST);
if (!RowSampler) {

@@ -528,3 +527,3 @@ alert("Error: Failed to create a row sampler");

// Allocate the OpenCL intermediate and result buffer memory objects on the device GMEM
ComputeBufTemp = ComputeContext.createBuffer(cl.MEM_READ_WRITE, image.szBuffBytes);
ComputeBufTemp = ComputeContext.createBuffer(WebCL.MEM_READ_WRITE, image.szBuffBytes);
if (!ComputeBufTemp) {

@@ -535,3 +534,3 @@ alert("Error: Failed to create temporary buffer");

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -575,3 +574,3 @@

cleanup();
if (initialize(ComputeDeviceType == cl.DEVICE_TYPE_GPU) != cl.SUCCESS)
if (initialize(ComputeDeviceType == WebCL.DEVICE_TYPE_GPU) != WebCL.SUCCESS)
shutdown();

@@ -596,3 +595,3 @@ gl.viewport(0, 0, Width, Height);

//DrawText(TextOffset[0], TextOffset[1], 1, (Animated == 0) ? "Press space to animate" : " ");
return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -655,3 +654,3 @@

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -661,3 +660,3 @@

// Setup Kernel Args
ckBoxColumns.setArg(1, cmOutputBuffer, cl.type.MEM);
ckBoxColumns.setArg(1, cmOutputBuffer, WebCL.type.MEM);

@@ -667,3 +666,3 @@ // 2D Image (Texture)

var TexRegion = [ image.width, image.height, 1 ]; // Size of texture region to operate on
ComputeCommands.enqueueWriteImage(ComputeTexture, cl.TRUE, TexOrigin,
ComputeCommands.enqueueWriteImage(ComputeTexture, WebCL.TRUE, TexOrigin,
TexRegion, 0, 0, image);

@@ -705,3 +704,3 @@

// init window
if(initialize(use_gpu)==cl.SUCCESS) {
if(initialize(use_gpu)==WebCL.SUCCESS) {
function update() {

@@ -708,0 +707,0 @@ display();

@@ -35,18 +35,16 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl=new WebCL();
//list of platforms
log("OpenCL SW Info:\n");
var platforms=cl.getPlatforms();
var platforms=WebCL.getPlatforms();
console.log('Found '+platforms.length+' plaforms');
platforms.forEach(function(p) {
//log(" Plaftorm ID: 0x"+p.getID().toString(16));
log(" PLATFORM_NAME: \t"+p.getInfo(cl.PLATFORM_NAME));
log(" PLATFORM_PROFILE: \t"+p.getInfo(cl.PLATFORM_PROFILE));
log(" PLATFORM_VERSION: \t"+p.getInfo(cl.PLATFORM_VERSION));
log(" PLATFORM_VENDOR: \t"+p.getInfo(cl.PLATFORM_VENDOR));
log(" PLATFORM_NAME: \t"+p.getInfo(WebCL.PLATFORM_NAME));
log(" PLATFORM_PROFILE: \t"+p.getInfo(WebCL.PLATFORM_PROFILE));
log(" PLATFORM_VERSION: \t"+p.getInfo(WebCL.PLATFORM_VERSION));
log(" PLATFORM_VENDOR: \t"+p.getInfo(WebCL.PLATFORM_VENDOR));
// PLATFORM_EXTENSIONS: get platform extensions, and if any then parse & log the string onto separate lines
log(" PLATFORM_EXTENSIONS:");
var platform_ext_string=p.getInfo(cl.PLATFORM_EXTENSIONS);
var platform_ext_string=p.getInfo(WebCL.PLATFORM_EXTENSIONS);
if (platform_ext_string.length > 0)

@@ -65,7 +63,7 @@ {

log("OpenCL Device Info:\n");
var devices = p.getDevices(cl.DEVICE_TYPE_ALL);
var devices = p.getDevices(WebCL.DEVICE_TYPE_ALL);
log('Found '+devices.length+' devices');
devices.forEach(function(device) {
log(" ---------------------------------");
log(' Device: '+device.getInfo(cl.DEVICE_NAME));
log(' Device: '+device.getInfo(WebCL.DEVICE_NAME));
log(" ---------------------------------");

@@ -77,5 +75,5 @@ printDeviceInfo(device);

try {
context = cl.createContext({
context = WebCL.createContext({
devices: device,
platform: p} ); //cl.createContext(cl.DEVICE_TYPE_DEFAULT, [cl.CONTEXT_PLATFORM, p]);
platform: p} );
}

@@ -92,7 +90,7 @@ catch(ex) {

var ctxDevices=context.getInfo(cl.CONTEXT_DEVICES);
var ctxDevices=context.getInfo(WebCL.CONTEXT_DEVICES);
// Determine and show image format support
// 2D
ImageFormats=context.getSupportedImageFormats(cl.MEM_READ_ONLY, cl.MEM_OBJECT_IMAGE2D);
ImageFormats=context.getSupportedImageFormats(WebCL.MEM_READ_ONLY, WebCL.MEM_OBJECT_IMAGE2D);
uiNumSupportedFormats=ImageFormats.length;

@@ -113,3 +111,3 @@

// 3D
ImageFormats=context.getSupportedImageFormats(cl.MEM_READ_ONLY, cl.MEM_OBJECT_IMAGE3D);
ImageFormats=context.getSupportedImageFormats(WebCL.MEM_READ_ONLY, WebCL.MEM_OBJECT_IMAGE3D);
uiNumSupportedFormats=ImageFormats.length;

@@ -131,9 +129,9 @@

// Size of basic types
log(" size of char: \t"+cl.size.CHAR);
log(" size of short: \t"+cl.size.SHORT);
log(" size of int: \t"+cl.size.INT);
log(" size of long: \t"+cl.size.LONG);
log(" size of float: \t"+cl.size.FLOAT);
log(" size of double: \t"+cl.size.DOUBLE);
log(" size of half: \t"+cl.size.HALF);
log(" size of char: \t"+WebCL.size.CHAR);
log(" size of short: \t"+WebCL.size.SHORT);
log(" size of int: \t"+WebCL.size.INT);
log(" size of long: \t"+WebCL.size.LONG);
log(" size of float: \t"+WebCL.size.FLOAT);
log(" size of double: \t"+WebCL.size.DOUBLE);
log(" size of half: \t"+WebCL.size.HALF);
});

@@ -143,21 +141,21 @@

{
log(" DEVICE_NAME: \t\t\t"+device.getInfo(cl.DEVICE_NAME));
log(" DEVICE_VENDOR: \t\t\t"+device.getInfo(cl.DEVICE_VENDOR));
log(" DRIVER_VERSION: \t\t\t"+device.getInfo(cl.DRIVER_VERSION));
log(" DEVICE_VERSION: \t\t\t"+device.getInfo(cl.DEVICE_VERSION));
log(" DEVICE_PROFILE: \t\t\t"+device.getInfo(cl.DEVICE_PROFILE));
log(" DEVICE_PLATFORM: \t\t\t0x"+device.getInfo(cl.DEVICE_PLATFORM).toString(16));
log(" DEVICE_OPENCL_C_VERSION: \t\t"+device.getInfo(cl.DEVICE_OPENCL_C_VERSION));
var type=parseInt(device.getInfo(cl.DEVICE_TYPE));
log(" DEVICE_NAME: \t\t\t"+device.getInfo(WebCL.DEVICE_NAME));
log(" DEVICE_VENDOR: \t\t\t"+device.getInfo(WebCL.DEVICE_VENDOR));
log(" DRIVER_VERSION: \t\t\t"+device.getInfo(WebCL.DRIVER_VERSION));
log(" DEVICE_VERSION: \t\t\t"+device.getInfo(WebCL.DEVICE_VERSION));
log(" DEVICE_PROFILE: \t\t\t"+device.getInfo(WebCL.DEVICE_PROFILE));
log(" DEVICE_PLATFORM: \t\t\t0x"+device.getInfo(WebCL.DEVICE_PLATFORM).toString(16));
log(" DEVICE_OPENCL_C_VERSION: \t\t"+device.getInfo(WebCL.DEVICE_OPENCL_C_VERSION));
var type=parseInt(device.getInfo(WebCL.DEVICE_TYPE));
var type_strings=[];
if( type & cl.DEVICE_TYPE_CPU )
if( type & WebCL.DEVICE_TYPE_CPU )
type_strings.push("cpu");
if( type & cl.DEVICE_TYPE_GPU )
if( type & WebCL.DEVICE_TYPE_GPU )
type_strings.push("gpu");
if( type & cl.DEVICE_TYPE_ACCELERATOR )
if( type & WebCL.DEVICE_TYPE_ACCELERATOR )
type_strings.push("accelerator");
if( type & cl.DEVICE_TYPE_DEFAULT )
if( type & WebCL.DEVICE_TYPE_DEFAULT )
type_strings.push("default");
// FIXME: 1.2
//if( type & cl.DEVICE_TYPE_CUSTOM )
//if( type & WebCL.DEVICE_TYPE_CUSTOM )
// type_strings.push("custom");

@@ -167,58 +165,58 @@ log(" DEVICE_TYPE:\t\t\t"+type_strings.join(" "));

var compute_units=0;
log(" DEVICE_MAX_COMPUTE_UNITS:\t\t"+(compute_units=device.getInfo(cl.DEVICE_MAX_COMPUTE_UNITS)));
log(" DEVICE_MAX_WORK_ITEM_DIMENSIONS:\t"+device.getInfo(cl.DEVICE_MAX_WORK_ITEM_DIMENSIONS));
log(" DEVICE_MAX_COMPUTE_UNITS:\t\t"+(compute_units=device.getInfo(WebCL.DEVICE_MAX_COMPUTE_UNITS)));
log(" DEVICE_MAX_WORK_ITEM_DIMENSIONS:\t"+device.getInfo(WebCL.DEVICE_MAX_WORK_ITEM_DIMENSIONS));
var workitem_sizes=device.getInfo(cl.DEVICE_MAX_WORK_ITEM_SIZES);
var workitem_sizes=device.getInfo(WebCL.DEVICE_MAX_WORK_ITEM_SIZES);
log(" DEVICE_MAX_WORK_ITEM_SIZES:\t"+workitem_sizes.join(" / "));
log(" DEVICE_MAX_WORK_GROUP_SIZE:\t"+device.getInfo(cl.DEVICE_MAX_WORK_GROUP_SIZE));
log(" DEVICE_MAX_CLOCK_FREQUENCY:\t"+device.getInfo(cl.DEVICE_MAX_CLOCK_FREQUENCY)+" MHz");
log(" DEVICE_ADDRESS_BITS:\t\t"+device.getInfo(cl.DEVICE_ADDRESS_BITS));
log(" DEVICE_MAX_MEM_ALLOC_SIZE:\t\t"+(device.getInfo(cl.DEVICE_MAX_MEM_ALLOC_SIZE) / (1024 * 1024))+" MBytes");
log(" DEVICE_GLOBAL_MEM_SIZE:\t\t"+(device.getInfo(cl.DEVICE_GLOBAL_MEM_SIZE) / (1024 * 1024))+" MBytes");
log(" DEVICE_ERROR_CORRECTION_SUPPORT:\t"+(device.getInfo(cl.DEVICE_ERROR_CORRECTION_SUPPORT) == cl.TRUE ? "yes" : "no"));
log(" DEVICE_MAX_WORK_GROUP_SIZE:\t"+device.getInfo(WebCL.DEVICE_MAX_WORK_GROUP_SIZE));
log(" DEVICE_MAX_CLOCK_FREQUENCY:\t"+device.getInfo(WebCL.DEVICE_MAX_CLOCK_FREQUENCY)+" MHz");
log(" DEVICE_ADDRESS_BITS:\t\t"+device.getInfo(WebCL.DEVICE_ADDRESS_BITS));
log(" DEVICE_MAX_MEM_ALLOC_SIZE:\t\t"+(device.getInfo(WebCL.DEVICE_MAX_MEM_ALLOC_SIZE) / (1024 * 1024))+" MBytes");
log(" DEVICE_GLOBAL_MEM_SIZE:\t\t"+(device.getInfo(WebCL.DEVICE_GLOBAL_MEM_SIZE) / (1024 * 1024))+" MBytes");
log(" DEVICE_ERROR_CORRECTION_SUPPORT:\t"+(device.getInfo(WebCL.DEVICE_ERROR_CORRECTION_SUPPORT) == WebCL.TRUE ? "yes" : "no"));
// DEVICE_LOCAL_MEM_TYPE
var local_mem_type=device.getInfo(cl.DEVICE_LOCAL_MEM_TYPE);
if( cache_type === cl.NONE )
var local_mem_type=device.getInfo(WebCL.DEVICE_LOCAL_MEM_TYPE);
if( cache_type === WebCL.NONE )
log(" DEVICE_LOCAL_MEM_TYPE:\t\tNONE");
if( cache_type === cl.LOCAL )
if( cache_type === WebCL.LOCAL )
log(" DEVICE_LOCAL_MEM_TYPE:\t\tLOCAL");
if( cache_type === cl.GLOBAL )
if( cache_type === WebCL.GLOBAL )
log(" DEVICE_LOCAL_MEM_TYPE:\t\tGLOBAL");
log(" DEVICE_LOCAL_MEM_SIZE:\t\t"+(device.getInfo(cl.DEVICE_LOCAL_MEM_SIZE) / 1024)+" KBytes");
log(" DEVICE_MAX_CONSTANT_BUFFER_SIZE:\t"+(device.getInfo(cl.DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024)+" KBytes");
log(" DEVICE_MAX_CONSTANT_BUFFER_SIZE:\t"+(device.getInfo(cl.DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024)+" KBytes");
log(" DEVICE_LOCAL_MEM_SIZE:\t\t"+(device.getInfo(WebCL.DEVICE_LOCAL_MEM_SIZE) / 1024)+" KBytes");
log(" DEVICE_MAX_CONSTANT_BUFFER_SIZE:\t"+(device.getInfo(WebCL.DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024)+" KBytes");
log(" DEVICE_MAX_CONSTANT_BUFFER_SIZE:\t"+(device.getInfo(WebCL.DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024)+" KBytes");
log(" DEVICE_MAX_SAMPLERS:\t"+device.getInfo(cl.DEVICE_MAX_SAMPLERS));
log(" DEVICE_MAX_PARAMETER_SIZE:\t"+device.getInfo(cl.DEVICE_MAX_PARAMETER_SIZE));
log(" DEVICE_MEM_BASE_ADDR_ALIGN:\t"+device.getInfo(cl.DEVICE_MEM_BASE_ADDR_ALIGN));
log(" DEVICE_MIN_DATA_TYPE_ALIGN_SIZE:\t"+device.getInfo(cl.DEVICE_MIN_DATA_TYPE_ALIGN_SIZE));
log(" DEVICE_MAX_SAMPLERS:\t"+device.getInfo(WebCL.DEVICE_MAX_SAMPLERS));
log(" DEVICE_MAX_PARAMETER_SIZE:\t"+device.getInfo(WebCL.DEVICE_MAX_PARAMETER_SIZE));
log(" DEVICE_MEM_BASE_ADDR_ALIGN:\t"+device.getInfo(WebCL.DEVICE_MEM_BASE_ADDR_ALIGN));
log(" DEVICE_MIN_DATA_TYPE_ALIGN_SIZE:\t"+device.getInfo(WebCL.DEVICE_MIN_DATA_TYPE_ALIGN_SIZE));
var cache_type=device.getInfo(cl.DEVICE_GLOBAL_MEM_CACHE_TYPE);
if( cache_type === cl.NONE )
var cache_type=device.getInfo(WebCL.DEVICE_GLOBAL_MEM_CACHE_TYPE);
if( cache_type === WebCL.NONE )
log(" DEVICE_GLOBAL_MEM_CACHE_TYPE:\t\tNONE");
if( cache_type === cl.READ_ONLY_CACHE )
if( cache_type === WebCL.READ_ONLY_CACHE )
log(" DEVICE_GLOBAL_MEM_CACHE_TYPE:\t\tREAD_ONLY_CACHE");
if( cache_type === cl.READ_WRITE_CACHE )
if( cache_type === WebCL.READ_WRITE_CACHE )
log(" DEVICE_GLOBAL_MEM_CACHE_TYPE:\t\tREAD_WRITE_CACHE");
log(" DEVICE_GLOBAL_MEM_CACHE_SIZE:\t\t"+(device.getInfo(cl.DEVICE_GLOBAL_MEM_CACHE_SIZE) / (1024))+" KBytes");
log(" DEVICE_GLOBAL_MEM_CACHELINE_SIZE:\t\t"+device.getInfo(cl.DEVICE_GLOBAL_MEM_CACHELINE_SIZE)+" Bytes");
log(" DEVICE_GLOBAL_MEM_CACHE_SIZE:\t\t"+(device.getInfo(WebCL.DEVICE_GLOBAL_MEM_CACHE_SIZE) / (1024))+" KBytes");
log(" DEVICE_GLOBAL_MEM_CACHELINE_SIZE:\t\t"+device.getInfo(WebCL.DEVICE_GLOBAL_MEM_CACHELINE_SIZE)+" Bytes");
log(" DEVICE_MAX_CONSTANT_ARGS:\t"+device.getInfo(cl.DEVICE_MAX_CONSTANT_ARGS));
log(" DEVICE_HOST_UNIFIED_MEMORY:\t"+device.getInfo(cl.DEVICE_HOST_UNIFIED_MEMORY));
log(" DEVICE_PROFILING_TIMER_RESOLUTION:\t"+device.getInfo(cl.DEVICE_PROFILING_TIMER_RESOLUTION));
log(" DEVICE_ENDIAN_LITTLE:\t"+device.getInfo(cl.DEVICE_ENDIAN_LITTLE));
log(" DEVICE_MAX_CONSTANT_ARGS:\t"+device.getInfo(WebCL.DEVICE_MAX_CONSTANT_ARGS));
log(" DEVICE_HOST_UNIFIED_MEMORY:\t"+device.getInfo(WebCL.DEVICE_HOST_UNIFIED_MEMORY));
log(" DEVICE_PROFILING_TIMER_RESOLUTION:\t"+device.getInfo(WebCL.DEVICE_PROFILING_TIMER_RESOLUTION));
log(" DEVICE_ENDIAN_LITTLE:\t"+device.getInfo(WebCL.DEVICE_ENDIAN_LITTLE));
log(" DEVICE_AVAILABLE:\t"+device.getInfo(cl.DEVICE_AVAILABLE));
log(" DEVICE_COMPILER_AVAILABLE:\t"+device.getInfo(cl.DEVICE_COMPILER_AVAILABLE));
log(" DEVICE_AVAILABLE:\t"+device.getInfo(WebCL.DEVICE_AVAILABLE));
log(" DEVICE_COMPILER_AVAILABLE:\t"+device.getInfo(WebCL.DEVICE_COMPILER_AVAILABLE));
// DEVICE_EXECUTION_CAPABILITIES
var execution_capabilities=device.getInfo(cl.DEVICE_EXECUTION_CAPABILITIES);
var execution_capabilities=device.getInfo(WebCL.DEVICE_EXECUTION_CAPABILITIES);
var execution_capabilities_strings=[];
if( execution_capabilities & cl.EXEC_KERNEL )
if( execution_capabilities & WebCL.EXEC_KERNEL )
execution_capabilities_strings.push("kernel");
if( execution_capabilities & cl.EXEC_NATIVE_KERNEL )
if( execution_capabilities & WebCL.EXEC_NATIVE_KERNEL )
execution_capabilities_strings.push("native-kernel");

@@ -228,7 +226,7 @@ log(" DEVICE_EXECUTION_CAPABILITIES:\t\t"+execution_capabilities_strings.join(" "));

// DEVICE_QUEUE_PROPERTIES
var queue_properties=device.getInfo(cl.DEVICE_QUEUE_PROPERTIES);
var queue_properties=device.getInfo(WebCL.DEVICE_QUEUE_PROPERTIES);
var queue_properties_strings=[];
if( queue_properties & cl.QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE )
if( queue_properties & WebCL.QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE )
queue_properties_strings.push("out-of-order-exec-mode");
if( queue_properties & cl.QUEUE_PROFILING_ENABLE )
if( queue_properties & WebCL.QUEUE_PROFILING_ENABLE )
queue_properties_strings.push("profiling");

@@ -238,5 +236,5 @@ log(" DEVICE_QUEUE_PROPERTIES:\t\t"+queue_properties_strings.join(" "));

// image support
log(" DEVICE_IMAGE_SUPPORT:\t\t"+device.getInfo(cl.DEVICE_IMAGE_SUPPORT));
log(" DEVICE_MAX_READ_IMAGE_ARGS:\t"+device.getInfo(cl.DEVICE_MAX_READ_IMAGE_ARGS));
log(" DEVICE_MAX_WRITE_IMAGE_ARGS:\t"+device.getInfo(cl.DEVICE_MAX_WRITE_IMAGE_ARGS));
log(" DEVICE_IMAGE_SUPPORT:\t\t"+device.getInfo(WebCL.DEVICE_IMAGE_SUPPORT));
log(" DEVICE_MAX_READ_IMAGE_ARGS:\t"+device.getInfo(WebCL.DEVICE_MAX_READ_IMAGE_ARGS));
log(" DEVICE_MAX_WRITE_IMAGE_ARGS:\t"+device.getInfo(WebCL.DEVICE_MAX_WRITE_IMAGE_ARGS));

@@ -248,15 +246,15 @@ function fp_config_info(type, name)

var fp_config_strings=[];
if( fp_config & cl.FP_DENORM )
if( fp_config & WebCL.FP_DENORM )
fp_config_strings.push("denorms");
if( fp_config & cl.FP_INF_NAN )
if( fp_config & WebCL.FP_INF_NAN )
fp_config_strings.push("INF-quietNaNs");
if( fp_config & cl.FP_ROUND_TO_NEAREST )
if( fp_config & WebCL.FP_ROUND_TO_NEAREST )
fp_config_strings.push("round-to-nearest");
if( fp_config & cl.FP_ROUND_TO_ZERO )
if( fp_config & WebCL.FP_ROUND_TO_ZERO )
fp_config_strings.push("round-to-zero");
if( fp_config & cl.FP_ROUND_TO_INF )
if( fp_config & WebCL.FP_ROUND_TO_INF )
fp_config_strings.push("round-to-inf");
if( fp_config & cl.FP_FMA )
if( fp_config & WebCL.FP_FMA )
fp_config_strings.push("fma");
if( fp_config & cl.FP_SOFT_FLOAT )
if( fp_config & WebCL.FP_SOFT_FLOAT )
fp_config_strings.push("soft-float");

@@ -266,16 +264,28 @@ log(" "+name+":\t\t"+fp_config_strings.join(" "));

fp_config_info(cl.DEVICE_HALF_FP_CONFIG, "DEVICE_HALF_FP_CONFIG");
fp_config_info(cl.DEVICE_SINGLE_FP_CONFIG, "DEVICE_SINGLE_FP_CONFIG");
fp_config_info(cl.DEVICE_DOUBLE_FP_CONFIG, "DEVICE_DOUBLE_FP_CONFIG");
try {
fp_config_info(WebCL.DEVICE_HALF_FP_CONFIG, "DEVICE_HALF_FP_CONFIG");
}
catch(ex) {
log(" DEVICE_HALF_FP_CONFIG:\t\tnot supported");
}
fp_config_info(WebCL.DEVICE_SINGLE_FP_CONFIG, "DEVICE_SINGLE_FP_CONFIG");
try {
fp_config_info(WebCL.DEVICE_DOUBLE_FP_CONFIG, "DEVICE_DOUBLE_FP_CONFIG");
}
catch(ex) {
log(" DEVICE_DOUBLE_FP_CONFIG:\t\tnot supported");
}
log("\n DEVICE_IMAGE <dim>");
log("\t\t\t\t\t2D_MAX_WIDTH\t "+device.getInfo(cl.DEVICE_IMAGE2D_MAX_WIDTH));
log("\t\t\t\t\t2D_MAX_HEIGHT\t "+device.getInfo(cl.DEVICE_IMAGE2D_MAX_HEIGHT));
log("\t\t\t\t\t3D_MAX_WIDTH\t "+device.getInfo(cl.DEVICE_IMAGE3D_MAX_WIDTH));
log("\t\t\t\t\t3D_MAX_HEIGHT\t "+device.getInfo(cl.DEVICE_IMAGE3D_MAX_HEIGHT));
log("\t\t\t\t\t3D_MAX_DEPTH\t "+device.getInfo(cl.DEVICE_IMAGE3D_MAX_DEPTH));
log("\t\t\t\t\t2D_MAX_WIDTH\t "+device.getInfo(WebCL.DEVICE_IMAGE2D_MAX_WIDTH));
log("\t\t\t\t\t2D_MAX_HEIGHT\t "+device.getInfo(WebCL.DEVICE_IMAGE2D_MAX_HEIGHT));
log("\t\t\t\t\t3D_MAX_WIDTH\t "+device.getInfo(WebCL.DEVICE_IMAGE3D_MAX_WIDTH));
log("\t\t\t\t\t3D_MAX_HEIGHT\t "+device.getInfo(WebCL.DEVICE_IMAGE3D_MAX_HEIGHT));
log("\t\t\t\t\t3D_MAX_DEPTH\t "+device.getInfo(WebCL.DEVICE_IMAGE3D_MAX_DEPTH));
// DEVICE_EXTENSIONS: get device extensions, and if any then parse & log the string onto separate lines
log("\n DEVICE_EXTENSIONS:");
var device_string=device.getInfo(cl.DEVICE_EXTENSIONS);
var device_string=device.getInfo(WebCL.DEVICE_EXTENSIONS);
var nv_device_attibute_query=false;

@@ -296,12 +306,12 @@ if (device_string.length > 0)

{
var compute_capability_major=device.getInfo(cl.DEVICE_COMPUTE_CAPABILITY_MAJOR_NV);
var compute_capability_minor=device.getInfo(cl.DEVICE_COMPUTE_CAPABILITY_MINOR_NV);
var compute_capability_major=device.getInfo(WebCL.DEVICE_COMPUTE_CAPABILITY_MAJOR_NV);
var compute_capability_minor=device.getInfo(WebCL.DEVICE_COMPUTE_CAPABILITY_MINOR_NV);
log("\n DEVICE_COMPUTE_CAPABILITY_NV:\t"+compute_capability_major+'.'+compute_capability_minor);
log(" NUMBER OF MULTIPROCESSORS:\t\t"+compute_units); // this is the same value reported by DEVICE_MAX_COMPUTE_UNITS
log(" NUMBER OF CUDA CORES:\t\t\t"+NV_ConvertSMVer2Cores(compute_capability_major, compute_capability_minor) * compute_units);
log(" DEVICE_REGISTERS_PER_BLOCK_NV:\t"+device.getInfo(cl.DEVICE_REGISTERS_PER_BLOCK_NV));
log(" DEVICE_WARP_SIZE_NV:\t\t"+device.getInfo(cl.DEVICE_WARP_SIZE_NV));
log(" DEVICE_GPU_OVERLAP_NV:\t\t"+(device.getInfo(cl.DEVICE_GPU_OVERLAP_NV) == cl.TRUE ? "TRUE" : "FALSE"));
log(" DEVICE_KERNEL_EXEC_TIMEOUT_NV:\t"+(device.getInfo(cl.DEVICE_KERNEL_EXEC_TIMEOUT_NV) == cl.TRUE ? "TRUE" : "FALSE"));
log(" DEVICE_INTEGRATED_MEMORY_NV:\t"+(device.getInfo(cl.DEVICE_INTEGRATED_MEMORY_NV) == cl.TRUE ? "TRUE" : "FALSE"));
log(" DEVICE_REGISTERS_PER_BLOCK_NV:\t"+device.getInfo(WebCL.DEVICE_REGISTERS_PER_BLOCK_NV));
log(" DEVICE_WARP_SIZE_NV:\t\t"+device.getInfo(WebCL.DEVICE_WARP_SIZE_NV));
log(" DEVICE_GPU_OVERLAP_NV:\t\t"+(device.getInfo(WebCL.DEVICE_GPU_OVERLAP_NV) == WebCL.TRUE ? "TRUE" : "FALSE"));
log(" DEVICE_KERNEL_EXEC_TIMEOUT_NV:\t"+(device.getInfo(WebCL.DEVICE_KERNEL_EXEC_TIMEOUT_NV) == WebCL.TRUE ? "TRUE" : "FALSE"));
log(" DEVICE_INTEGRATED_MEMORY_NV:\t"+(device.getInfo(WebCL.DEVICE_INTEGRATED_MEMORY_NV) == WebCL.TRUE ? "TRUE" : "FALSE"));
}

@@ -312,8 +322,8 @@

var vec_width= [
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_CHAR),
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_SHORT),
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_INT),
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_LONG),
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT),
device.getInfo(cl.DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_CHAR),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_SHORT),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_INT),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_LONG),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT),
device.getInfo(WebCL.DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE),
];

@@ -325,8 +335,8 @@ log('\tCHAR '+vec_width[0]+', SHORT '+vec_width[1]+', INT '+vec_width[2]+', LONG '+vec_width[3]+

var vec_native_width= [
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_CHAR),
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_SHORT),
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_INT),
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_LONG),
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_FLOAT),
device.getInfo(cl.DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_CHAR),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_SHORT),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_INT),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_LONG),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_FLOAT),
device.getInfo(WebCL.DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE),
];

@@ -367,29 +377,29 @@ log('\tCHAR '+vec_native_width[0]+', SHORT '+vec_native_width[1]+', INT '+vec_native_width[2]+

// channel_order
if (uiImageFormat == cl.R)return "R";
if (uiImageFormat == cl.A)return "A";
if (uiImageFormat == cl.RG)return "RG";
if (uiImageFormat == cl.RA)return "RA";
if (uiImageFormat == cl.RGB)return "RGB";
if (uiImageFormat == cl.RGBA)return "RGBA";
if (uiImageFormat == cl.BGRA)return "BGRA";
if (uiImageFormat == cl.ARGB)return "ARGB";
if (uiImageFormat == cl.INTENSITY)return "INTENSITY";
if (uiImageFormat == cl.LUMINANCE)return "LUMINANCE";
if (uiImageFormat == WebCL.R)return "R";
if (uiImageFormat == WebCL.A)return "A";
if (uiImageFormat == WebCL.RG)return "RG";
if (uiImageFormat == WebCL.RA)return "RA";
if (uiImageFormat == WebCL.RGB)return "RGB";
if (uiImageFormat == WebCL.RGBA)return "RGBA";
if (uiImageFormat == WebCL.BGRA)return "BGRA";
if (uiImageFormat == WebCL.ARGB)return "ARGB";
if (uiImageFormat == WebCL.INTENSITY)return "INTENSITY";
if (uiImageFormat == WebCL.LUMINANCE)return "LUMINANCE";
// channel_type
if (uiImageFormat == cl.SNORM_INT8)return "SNORM_INT8";
if (uiImageFormat == cl.SNORM_INT16)return "SNORM_INT16";
if (uiImageFormat == cl.UNORM_INT8)return "UNORM_INT8";
if (uiImageFormat == cl.UNORM_INT16)return "UNORM_INT16";
if (uiImageFormat == cl.UNORM_SHORT_565)return "UNORM_SHORT_565";
if (uiImageFormat == cl.UNORM_SHORT_555)return "UNORM_SHORT_555";
if (uiImageFormat == cl.UNORM_INT_101010)return "UNORM_INT_101010";
if (uiImageFormat == cl.SIGNED_INT8)return "SIGNED_INT8";
if (uiImageFormat == cl.SIGNED_INT16)return "SIGNED_INT16";
if (uiImageFormat == cl.SIGNED_INT32)return "SIGNED_INT32";
if (uiImageFormat == cl.UNSIGNED_INT8)return "UNSIGNED_INT8";
if (uiImageFormat == cl.UNSIGNED_INT16)return "UNSIGNED_INT16";
if (uiImageFormat == cl.UNSIGNED_INT32)return "UNSIGNED_INT32";
if (uiImageFormat == cl.HALF_FLOAT)return "HALF_FLOAT";
if (uiImageFormat == cl.FLOAT)return "FLOAT";
if (uiImageFormat == WebCL.SNORM_INT8)return "SNORM_INT8";
if (uiImageFormat == WebCL.SNORM_INT16)return "SNORM_INT16";
if (uiImageFormat == WebCL.UNORM_INT8)return "UNORM_INT8";
if (uiImageFormat == WebCL.UNORM_INT16)return "UNORM_INT16";
if (uiImageFormat == WebCL.UNORM_SHORT_565)return "UNORM_SHORT_565";
if (uiImageFormat == WebCL.UNORM_SHORT_555)return "UNORM_SHORT_555";
if (uiImageFormat == WebCL.UNORM_INT_101010)return "UNORM_INT_101010";
if (uiImageFormat == WebCL.SIGNED_INT8)return "SIGNED_INT8";
if (uiImageFormat == WebCL.SIGNED_INT16)return "SIGNED_INT16";
if (uiImageFormat == WebCL.SIGNED_INT32)return "SIGNED_INT32";
if (uiImageFormat == WebCL.UNSIGNED_INT8)return "UNSIGNED_INT8";
if (uiImageFormat == WebCL.UNSIGNED_INT16)return "UNSIGNED_INT16";
if (uiImageFormat == WebCL.UNSIGNED_INT32)return "UNSIGNED_INT32";
if (uiImageFormat == WebCL.HALF_FLOAT)return "HALF_FLOAT";
if (uiImageFormat == WebCL.FLOAT)return "FLOAT";

@@ -396,0 +406,0 @@ // unknown constant

@@ -37,6 +37,4 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl = new WebCL();
//First check if the webcl extension is installed at all
if (cl == undefined) {
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. " +

@@ -67,12 +65,12 @@ "Make sure that you have the WebCL extension installed.");

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
var platform=platformList[0];
// create GPU context for this platform
var context=cl.createContext({
deviceType: cl.DEVICE_TYPE_GPU,
var context=WebCL.createContext({
deviceType: WebCL.DEVICE_TYPE_GPU,
platform: platform});
// find the device for this context
var devices = context.getInfo(cl.CONTEXT_DEVICES);
var devices = context.getInfo(WebCL.CONTEXT_DEVICES);
if(!devices) {

@@ -87,4 +85,4 @@ alert("Error: Failed to retrieve compute devices for context!");

{
var device_type=devices[i].getInfo(cl.DEVICE_TYPE);
if(device_type == cl.DEVICE_TYPE_GPU)
var device_type=devices[i].getInfo(WebCL.DEVICE_TYPE);
if(device_type == WebCL.DEVICE_TYPE_GPU)
{

@@ -105,4 +103,4 @@ device = devices[i];

//
var vendor_name = device.getInfo(cl.DEVICE_VENDOR);
var device_name = device.getInfo(cl.DEVICE_NAME);
var vendor_name = device.getInfo(WebCL.DEVICE_VENDOR);
var device_name = device.getInfo(WebCL.DEVICE_NAME);

@@ -121,4 +119,4 @@ log("Connecting to: "+vendor_name+" "+device_name);

try {
cmPinnedBufIn = context.createBuffer(cl.MEM_READ_ONLY | cl.MEM_ALLOC_HOST_PTR, image.size);
cmPinnedBufOut = context.createBuffer(cl.MEM_WRITE_ONLY | cl.MEM_ALLOC_HOST_PTR, image.size);
cmPinnedBufIn = context.createBuffer(WebCL.MEM_READ_ONLY | WebCL.MEM_ALLOC_HOST_PTR, image.size);
cmPinnedBufOut = context.createBuffer(WebCL.MEM_WRITE_ONLY | WebCL.MEM_ALLOC_HOST_PTR, image.size);
}

@@ -135,3 +133,3 @@ catch(err) {

catch(err) {
console.log(program.getBuildInfo(device,cl.PROGRAM_BUILD_LOG));
console.log(program.getBuildInfo(device,WebCL.PROGRAM_BUILD_LOG));
}

@@ -142,4 +140,4 @@

kernel.setArg(1, cmPinnedBufOut);
kernel.setArg(2, image.width, cl.type.UINT);
kernel.setArg(3, image.height, cl.type.UINT);
kernel.setArg(2, image.width, WebCL.type.UINT);
kernel.setArg(3, image.height, WebCL.type.UINT);

@@ -151,3 +149,3 @@ //Create command queue

// Get the maximum work group size for executing the kernel on the device
var localWS=[ kernel.getWorkGroupInfo(device, cl.KERNEL_WORK_GROUP_SIZE) ];
var localWS=[ kernel.getWorkGroupInfo(device, WebCL.KERNEL_WORK_GROUP_SIZE) ];
var globalWS = [ localWS[0] * clu.DivUp(image.size, localWS[0]) ];

@@ -154,0 +152,0 @@

@@ -38,4 +38,6 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

Graphics = require('./graphics');
Compute = require('./compute');
//Compute = require('./compute_julia');
argv=require('optimist').argv;
Compute = require(argv.compute || './compute');
//Compute = require('./compute_droplet2d');
//Compute = require('./compute_droplet3d');
}

@@ -46,11 +48,14 @@

//var COMPUTE_KERNEL_ID = "704.cl";
var COMPUTE_KERNEL_ID = "mandelbulb2.cl";
var COMPUTE_KERNEL_ID = "704.cl";
//var COMPUTE_KERNEL_ID = argv.kernel || "mandelbulb_AoS.cl";
//var COMPUTE_KERNEL_ID = "qjulia.cl";
//var COMPUTE_KERNEL_ID = "droplet2d.cl";
//var COMPUTE_KERNEL_ID = "droplet3d.cl";
var COMPUTE_KERNEL_NAME = "compute";
var WIDTH = 512;
var HEIGHT = 512;
var WIDTH = argv.width || 512;
var HEIGHT = argv.height || 512;
var Width = WIDTH;
var Height = HEIGHT;
var Reshaped = true;
var cango=false;

@@ -61,5 +66,6 @@ /*

function reshape(evt) {
Width = evt.width;
Height = evt.height;
Reshaped = true;
Width = evt.width;
Height = evt.height;
Reshaped = true;
log('reshape texture to '+Width+'x'+Height);
}

@@ -70,3 +76,4 @@

//Update = true;
Update = true;
//cango=true;
}

@@ -83,3 +90,3 @@

document.addEventListener('resize', reshape);
//document.addEventListener('keydown', keydown);
document.addEventListener('keydown', keydown);

@@ -121,3 +128,3 @@ // init WebGL

if (Reshaped) {
log('reshaping texture');
log('reshaping texture to '+Width+'x'+Height);
try {

@@ -128,3 +135,3 @@ var glTexture=gfx.configure_shared_data(Width,Height);

}
catch(err) {
catch(ex) {
log('[Error] While reshaping shared data: '+ex);

@@ -156,6 +163,8 @@ return;

gfx.gl().finish(); // for timing
requestAnimationFrame(update,0);
//gfx.gl().flush(); // for timing
//if(!cango)
// startTime=-1;
requestAnimationFrame(update /*,cango ? 0 : 5000*/);
})();
})();

@@ -6,3 +6,2 @@ /*

function Compute() {
var cl=new WebCL();
var orig=require('./compute')();

@@ -88,5 +87,5 @@ var orig_resetKernelArgs = orig.resetKernelArgs;

// Set the Argument values for the row kernel
clKernel.setArg(2, mu, cl.type.FLOAT | cl.type.VEC4);
clKernel.setArg(3, diffuse, cl.type.FLOAT | cl.type.VEC4);
clKernel.setArg(4, Epsilon, cl.type.FLOAT);
clKernel.setArg(2, mu, WebCL.type.FLOAT | WebCL.type.VEC4);
clKernel.setArg(3, diffuse, WebCL.type.FLOAT | WebCL.type.VEC4);
clKernel.setArg(4, Epsilon, WebCL.type.FLOAT);
} catch (err) {

@@ -93,0 +92,0 @@ throw "Failed to set Julia kernel args! " + err;

@@ -6,3 +6,2 @@ /*

function Compute() {
var cl=new WebCL();
var /* cl_context */ clContext;

@@ -12,3 +11,3 @@ var /* cl_command_queue */ clQueue;

var /* cl_device_id */ clDevice;
var /* cl_device_type */ clDeviceType = cl.DEVICE_TYPE_GPU;
var /* cl_device_type */ clDeviceType = WebCL.DEVICE_TYPE_GPU;
var /* cl_image */ clTexture;

@@ -40,3 +39,3 @@ var /* cl_kernel */ clKernel;

// Pick platform
var platformList = cl.getPlatforms();
var platformList = WebCL.getPlatforms();
var platform = platformList[0];

@@ -46,3 +45,3 @@

try {
clContext = cl.createContext({
clContext = WebCL.createContext({
deviceType: clDeviceType,

@@ -56,3 +55,3 @@ shareGroup: gl,

var device_ids = clContext.getInfo(cl.CONTEXT_DEVICES);
var device_ids = clContext.getInfo(WebCL.CONTEXT_DEVICES);
if (!device_ids) {

@@ -65,3 +64,3 @@ throw "Error: Failed to retrieve compute devices for context!";

for(var i=0,l=device_ids.length;i<l;++i ) {
device_type = device_ids[i].getInfo(cl.DEVICE_TYPE);
device_type = device_ids[i].getInfo(WebCL.DEVICE_TYPE);
if (device_type == clDeviceType) {

@@ -77,3 +76,3 @@ clDevice = device_ids[i];

if (!clDevice.getInfo(cl.DEVICE_IMAGE_SUPPORT))
if (!clDevice.getInfo(WebCL.DEVICE_IMAGE_SUPPORT))
throw "Application requires images: Images not supported on this device.";

@@ -90,11 +89,11 @@

// Report the device vendor and device name
var vendor_name = clDevice.getInfo(cl.DEVICE_VENDOR);
var device_name = clDevice.getInfo(cl.DEVICE_NAME);
var vendor_name = clDevice.getInfo(WebCL.DEVICE_VENDOR);
var device_name = clDevice.getInfo(WebCL.DEVICE_NAME);
log(" Connecting to " + vendor_name + " " + device_name);
log(" Global mem cache size: " + (clDevice.getInfo(cl.DEVICE_GLOBAL_MEM_CACHE_SIZE)/1024) + "kB " );
log(" Local mem size : " + (clDevice.getInfo(cl.DEVICE_LOCAL_MEM_SIZE)/1024) + "kB " );
log(" Max compute units : " + clDevice.getInfo(cl.DEVICE_MAX_COMPUTE_UNITS));
log(" Max work-item sizes : "+clDevice.getInfo(cl.DEVICE_MAX_WORK_ITEM_SIZES));
log(" Max work-group size : "+clDevice.getInfo(cl.DEVICE_MAX_WORK_GROUP_SIZE));
log(" Global mem cache size: " + (clDevice.getInfo(WebCL.DEVICE_GLOBAL_MEM_CACHE_SIZE)/1024) + "kB " );
log(" Local mem size : " + (clDevice.getInfo(WebCL.DEVICE_LOCAL_MEM_SIZE)/1024) + "kB " );
log(" Max compute units : " + clDevice.getInfo(WebCL.DEVICE_MAX_COMPUTE_UNITS));
log(" Max work-item sizes : "+clDevice.getInfo(WebCL.DEVICE_MAX_WORK_ITEM_SIZES));
log(" Max work-group size : "+clDevice.getInfo(WebCL.DEVICE_MAX_WORK_GROUP_SIZE));

@@ -152,3 +151,3 @@ init_cl_buffers();

throw "Error: Failed to build program executable!\n"
+ clProgram.getBuildInfo(clDevice, cl.PROGRAM_BUILD_LOG);
+ clProgram.getBuildInfo(clDevice, WebCL.PROGRAM_BUILD_LOG);
}

@@ -165,7 +164,7 @@

// Get the device intrinsics for executing the kernel on the device
max_workgroup_size = clKernel.getWorkGroupInfo(clDevice, cl.KERNEL_WORK_GROUP_SIZE);
warp_size=clKernel.getWorkGroupInfo(clDevice, cl.KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE);
max_workgroup_size = clKernel.getWorkGroupInfo(clDevice, WebCL.KERNEL_WORK_GROUP_SIZE);
warp_size=clKernel.getWorkGroupInfo(clDevice, WebCL.KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE);
log(' max workgroup size: '+max_workgroup_size);
log(' local mem used : '+clKernel.getWorkGroupInfo(clDevice, cl.KERNEL_LOCAL_MEM_SIZE)+" bytes");
log(' private mem used : '+clKernel.getWorkGroupInfo(clDevice, cl.KERNEL_PRIVATE_MEM_SIZE)+" bytes");
log(' local mem used : '+clKernel.getWorkGroupInfo(clDevice, WebCL.KERNEL_LOCAL_MEM_SIZE)+" bytes");
log(' private mem used : '+clKernel.getWorkGroupInfo(clDevice, WebCL.KERNEL_PRIVATE_MEM_SIZE)+" bytes");
log(' warp size : '+warp_size);

@@ -188,3 +187,3 @@ }

clKernel.setArg(0, clTexture);
clKernel.setArg(1, time, cl.type.FLOAT);
clKernel.setArg(1, time, WebCL.type.FLOAT);
} catch (err) {

@@ -212,5 +211,6 @@ throw "Failed to set row kernel args! " + err;

// Create OpenCL representation of OpenGL Texture
if(clTexture) clTexture.release();
clTexture = null;
try {
clTexture = clContext.createFromGLTexture2D(cl.MEM_WRITE_ONLY,
clTexture = clContext.createFromGLTexture(WebCL.MEM_WRITE_ONLY,
gl.TEXTURE_2D, 0, glTexture);

@@ -217,0 +217,0 @@ } catch (ex) {

@@ -132,2 +132,6 @@ var nodejs = (typeof window === 'undefined');

gl.disable(gl.DEPTH_TEST);
gl.disable(gl.CULL_FACE);
//gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.enable(gl.TEXTURE_2D);

@@ -154,11 +158,18 @@ gl.bindTexture(gl.TEXTURE_2D, TextureId);

fpsFrame++;
var dt=timestamp - fpsTo;
var ti=new Date().getTime();
var dt=ti - fpsTo;
if( dt>1000 ) {
ffps = 1000.0 * fpsFrame / dt;
ffps = 2*1000 * fpsFrame / dt;
fpsFrame = 0;
fpsTo = timestamp;
fpsTo = ti;
}
/*if( fpsFrame==10 ) {
var ti=new Date().getTime();
ffps = 2*1000.0 * fpsFrame / (ti-fpsTo);
fpsFrame = 0;
fpsTo = ti;
}*/
//if(nodejs)
// drawATB();
if(nodejs)
drawATB();
}

@@ -180,4 +191,6 @@

//ATB=canvas.AntTweakBar;
//initATB(canvas);
if(nodejs) {
ATB=canvas.AntTweakBar;
initATB(canvas);
}
}

@@ -197,4 +210,4 @@

//if(nodejs)
// ATB.WindowSize(TextureWidth,TextureHeight);
if(nodejs)
ATB.WindowSize(TextureWidth,TextureHeight);

@@ -227,5 +240,5 @@ gl.viewportWidth = TextureWidth;

twBar=new ATB.NewBar("clgl");
ATB.Define("clgl label='CLGL' refresh=0.1 position='16 16' size='200 100' valueswidth='fit' ");
ATB.Define("clgl label='CLGL' refresh=0.1 position='16 16' size='100 25' valueswidth='fit' valuesheight='fit' ");
var sceneTypes=ATB.DefineEnum('Scene Types',scenes, 2);
/*var sceneTypes=ATB.DefineEnum('Scene Types',scenes, 2);
twBar.AddVar("scenes", sceneTypes, {

@@ -243,3 +256,3 @@ getter: function(){ return sceneChoice; },

}, "label='reset' help='Reset the animation'");
*/
twBar.AddVar("fps", ATB.TYPE_FLOAT, {

@@ -246,0 +259,0 @@ getter: function(data){ return ffps; },

@@ -44,6 +44,4 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl = new WebCL();
//First check if the webcl extension is installed at all
if (cl == undefined) {
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. "

@@ -57,4 +55,4 @@ + "Make sure that you have the WebCL extension installed.");

var window_height = 512;
var mesh_width = 512;
var mesh_height = 512;
var mesh_width = 128;
var mesh_height = 128;

@@ -116,13 +114,13 @@ //OpenCL vars

// Pick platform
var platformList = cl.getPlatforms();
var platformList = WebCL.getPlatforms();
cpPlatform = platformList[0];
// Query the set of GPU devices on this platform
cdDevices = cpPlatform.getDevices(cl.DEVICE_TYPE_DEFAULT);
cdDevices = cpPlatform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
log(" # of Devices Available = " + cdDevices.length);
var device = cdDevices[0];
log(" Using Device 0: " + device.getInfo(cl.DEVICE_NAME));
log(" Using Device 0: " + device.getInfo(WebCL.DEVICE_NAME));
// get CL-GL extension
var extensions = device.getInfo(cl.DEVICE_EXTENSIONS);
var extensions = device.getInfo(WebCL.DEVICE_EXTENSIONS);
var hasGLSupport = extensions.search(/gl.sharing/i) >= 0;

@@ -134,3 +132,3 @@ log(hasGLSupport ? "GL-CL extension available ;-)" : "No GL support");

// create the OpenCL context
cxGPUContext = cl.createContext({
cxGPUContext = WebCL.createContext({
devices: device,

@@ -154,6 +152,6 @@ shareGroup: gl,

log("Build Status: "
+ cpProgram.getBuildInfo(device, cl.PROGRAM_BUILD_STATUS));
+ cpProgram.getBuildInfo(device, WebCL.PROGRAM_BUILD_STATUS));
log("Build Options: "
+ cpProgram.getBuildInfo(device, cl.PROGRAM_BUILD_OPTIONS));
log("Build Log: " + cpProgram.getBuildInfo(device, cl.PROGRAM_BUILD_LOG));
+ cpProgram.getBuildInfo(device, WebCL.PROGRAM_BUILD_OPTIONS));
log("Build Log: " + cpProgram.getBuildInfo(device, WebCL.PROGRAM_BUILD_LOG));

@@ -173,4 +171,4 @@ // create the kernel

ckKernel.setArg(0, vbo_cl);
ckKernel.setArg(1, mesh_width, cl.type.UINT);
ckKernel.setArg(2, mesh_height, cl.type.UINT);
ckKernel.setArg(1, mesh_width, WebCL.type.UINT);
ckKernel.setArg(2, mesh_height, WebCL.type.UINT);

@@ -296,3 +294,3 @@ // run OpenCL kernel once to generate vertex positions

// Set arg 3 and execute the kernel
ckKernel.setArg(3, time, cl.type.FLOAT);
ckKernel.setArg(3, time, WebCL.type.FLOAT);
cqCommandQueue.enqueueNDRangeKernel(ckKernel, null, szGlobalWorkSize, null);

@@ -317,3 +315,3 @@

// create OpenCL buffer from GL VBO
vbo_cl = cxGPUContext.createFromGLBuffer(cl.MEM_WRITE_ONLY, vbo);
vbo_cl = cxGPUContext.createFromGLBuffer(WebCL.MEM_WRITE_ONLY, vbo);
}

@@ -320,0 +318,0 @@

@@ -34,6 +34,4 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl = new WebCL();
//First check if the WebCL extension is installed at all
if (cl == undefined) {
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. " +

@@ -57,13 +55,13 @@ "Make sure that you have the WebCL extension installed.");

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT);
log('using device: '+devices[0].getInfo(cl.DEVICE_NAME));
devices = platform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
log('using device: '+devices[0].getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
context=cl.createContext({
deviceType: cl.DEVICE_TYPE_DEFAULT,
context=WebCL.createContext({
deviceType: WebCL.DEVICE_TYPE_DEFAULT,
platform: platform

@@ -90,7 +88,7 @@ });

// Create buffer for A and B and copy host contents
aBuffer = context.createBuffer(cl.MEM_READ_ONLY, size);
bBuffer = context.createBuffer(cl.MEM_READ_ONLY, size);
aBuffer = context.createBuffer(WebCL.MEM_READ_ONLY, size);
bBuffer = context.createBuffer(WebCL.MEM_READ_ONLY, size);
// Create buffer for C to read results
cBuffer = context.createBuffer(cl.MEM_WRITE_ONLY, size);
cBuffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, size);

@@ -102,3 +100,3 @@ // Create kernel object

catch(err) {
console.log(program.getBuildInfo(devices[0],cl.PROGRAM_BUILD_LOG));
console.log(program.getBuildInfo(devices[0],WebCL.PROGRAM_BUILD_LOG));
}

@@ -110,3 +108,3 @@

kernel.setArg(2, cBuffer);
kernel.setArg(3, BUFFER_SIZE, cl.type.UINT);
kernel.setArg(3, BUFFER_SIZE, WebCL.type.UINT);

@@ -113,0 +111,0 @@ // Create command queue

@@ -34,6 +34,4 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl = new WebCL();
//First check if the WebCL extension is installed at all
if (cl == undefined) {
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. " +

@@ -59,12 +57,12 @@ "Make sure that you have the WebCL extension installed.");

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
//Query the set of devices on this platform
devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT);
log('using device: '+devices[0].getInfo(cl.DEVICE_NAME));
devices = platform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
log('using device: '+devices[0].getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
context=cl.createContext({
deviceType: cl.DEVICE_TYPE_DEFAULT,
context=WebCL.createContext({
deviceType: WebCL.DEVICE_TYPE_DEFAULT,
platform: platform

@@ -95,3 +93,3 @@ });

catch(err) {
console.log(program.getBuildInfo(devices[0],cl.PROGRAM_BUILD_LOG));
console.log(program.getBuildInfo(devices[0],WebCL.PROGRAM_BUILD_LOG));
}

@@ -103,4 +101,4 @@

//Create buffer for A and copy host contents
aBuffer = context.createBuffer(cl.MEM_READ_ONLY, size);
map=queue.enqueueMapBuffer(aBuffer, cl.TRUE, cl.MAP_WRITE, 0, BUFFER_SIZE * Uint32Array.BYTES_PER_ELEMENT);
aBuffer = context.createBuffer(WebCL.MEM_READ_ONLY, size);
map=queue.enqueueMapBuffer(aBuffer, WebCL.TRUE, WebCL.MAP_WRITE, 0, BUFFER_SIZE * Uint32Array.BYTES_PER_ELEMENT);

@@ -115,4 +113,4 @@ // WARNING: this feature for typed arrays is only in nodejs 0.7.x

//Create buffer for B and copy host contents
bBuffer = context.createBuffer(cl.MEM_READ_ONLY, size);
map=queue.enqueueMapBuffer(bBuffer, cl.TRUE, cl.MAP_WRITE, 0, BUFFER_SIZE * Uint32Array.BYTES_PER_ELEMENT);
bBuffer = context.createBuffer(WebCL.MEM_READ_ONLY, size);
map=queue.enqueueMapBuffer(bBuffer, WebCL.TRUE, WebCL.MAP_WRITE, 0, BUFFER_SIZE * Uint32Array.BYTES_PER_ELEMENT);
buf=new Uint32Array(map);

@@ -125,3 +123,3 @@ for(var i=0;i<BUFFER_SIZE;i++) {

//Create buffer for that uses the host ptr C
cBuffer = context.createBuffer(cl.MEM_READ_WRITE, size);
cBuffer = context.createBuffer(WebCL.MEM_READ_WRITE, size);

@@ -132,3 +130,3 @@ //Set kernel args

kernel.setArg(2, cBuffer);
kernel.setArg(3, BUFFER_SIZE, cl.type.UINT);
kernel.setArg(3, BUFFER_SIZE, WebCL.type.UINT);

@@ -155,4 +153,4 @@ // Execute the OpenCL kernel on the list

cBuffer,
cl.TRUE, // block
cl.MAP_READ,
WebCL.TRUE, // block
WebCL.MAP_READ,
0,

@@ -159,0 +157,0 @@ BUFFER_SIZE * Uint32Array.BYTES_PER_ELEMENT);

{
"name":"node-webcl",
"version":"0.6.0",
"version":"0.6.1",
"description":"A WebCL implementation for desktops with NodeJS",

@@ -21,8 +21,6 @@ "main":"webcl.js",

],
"repositories":[
{
"type":"git",
"url":"https://github.com/Motorola-Mobility/node-webcl"
}
],
"repository": {
"type":"git",
"url":"https://github.com/Motorola-Mobility/node-webcl"
},
"directories":{

@@ -36,3 +34,3 @@ "src":"src",

"engines":{
"node":">=0.7.0"
"node":"0.7.0-0.11.3"
},

@@ -39,0 +37,0 @@ "scripts":{

@@ -28,1 +28,413 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

// Multiple bandwidth tests
var nodejs = (typeof window === 'undefined');
if(nodejs) {
WebCL = require('../webcl');
clu = require('../lib/clUtils');
log=console.log;
}
//defines, project
var MEMCOPY_ITERATIONS = 100;
var DEFAULT_SIZE = ( 10 * ( 1 << 20 ) ); // 10 M
var DEFAULT_INCREMENT = (1 << 22); //4 M
var CACHE_CLEAR_SIZE = (1 << 24); //16 M
//enums, project
var QUICK_MODE=0, RANGE_MODE=1; // test modes
var DEVICE_TO_HOST=0, HOST_TO_DEVICE=1, DEVICE_TO_DEVICE=2; // memory copy kind
var PAGEABLE=0, PINNED=1; // memory modes
var MAPPED=0, DIRECT=1; // access modes
//First check if the WebCL extension is installed at all
if (WebCL == undefined) {
alert("Unfortunately your system does not support WebCL. " +
"Make sure that you have the WebCL extension installed.");
return;
}
// Create the OpenCL context
var ctx=null;
try {
ctx=WebCL.createContext({
deviceType: WebCL.DEVICE_TYPE_ALL,
});
}
catch(ex) {
throw new Exception("Can't create CL context");
}
var devices=ctx.getInfo(WebCL.CONTEXT_DEVICES);
log("Found "+devices.length+" devices");
devices.forEach(function(d) {
d.units=d.getInfo(WebCL.DEVICE_MAX_COMPUTE_UNITS);
d.clock=d.getInfo(WebCL.DEVICE_MAX_CLOCK_FREQUENCY);
//var timerRes=d.getInfo(WebCL.DEVICE_PROFILING_TIMER_RESOLUTION);
d.type=d.getInfo(WebCL.DEVICE_TYPE);
d.endian=(d.getInfo(WebCL.DEVICE_ENDIAN_LITTLE) ? "LITTLE" : "BIG");
d.name=d.getInfo(WebCL.DEVICE_NAME);
if(d.type==WebCL.DEVICE_TYPE_CPU) d.type="CPU";
else if(d.type==WebCL.DEVICE_TYPE_GPU) d.type="GPU";
else if(d.type==WebCL.DEVICE_TYPE_ACCELERATOR) d.type="ACCELERATOR";
else d.type="DEFAULT";
var flops=d.units * d.clock;
log(" Device "+d.type+" "+d.name+": "+d.units+" CU @ "+d.clock+" MHz, " +
d.endian+" endian");
});
// Run tests
var start=DEFAULT_SIZE; // 1 MB
var end=2*DEFAULT_SIZE; // 20 MB
var increment = DEFAULT_INCREMENT;
var mode = RANGE_MODE;
var accMode = DIRECT;
var memMode = PAGEABLE;
var startDevice=0;
var endDevice=devices.length-1;
var cqCommandQueue=null;
testBandwidth(start, end, increment, mode, HOST_TO_DEVICE, accMode, memMode, startDevice, endDevice);
testBandwidth(start, end, increment, mode, DEVICE_TO_HOST, accMode, memMode, startDevice, endDevice);
testBandwidth(start, end, increment, mode, DEVICE_TO_DEVICE, accMode, memMode, startDevice, endDevice);
function
createQueue(device)
{
// Release if there previous is already one
//if(cqCommandQueue) {
// cqCommandQueue.release();
//}
cqCommandQueue = ctx.createCommandQueue(devices[device], WebCL.QUEUE_PROFILING_ENABLE);
}
///////////////////////////////////////////////////////////////////////////////
// Run a bandwidth test
///////////////////////////////////////////////////////////////////////////////
function
testBandwidth(start, end, increment,
mode, kind, printmode, accMode,
memMode, startDevice, endDevice)
{
switch(mode)
{
case QUICK_MODE:
testBandwidthQuick( DEFAULT_SIZE, kind, printmode, accMode, memMode, startDevice, endDevice);
break;
case RANGE_MODE:
testBandwidthRange(start, end, increment, kind, printmode, accMode, memMode, startDevice, endDevice);
break;
//case SHMOO_MODE:
// testBandwidthShmoo(kind, printmode, accMode, memMode, startDevice, endDevice);
// break;
default:
break;
}
}
//////////////////////////////////////////////////////////////////////
//Run a quick mode bandwidth test
//////////////////////////////////////////////////////////////////////
function
testBandwidthQuick(size, kind, printmode, accMode,
memMode, startDevice, endDevice)
{
testBandwidthRange(size, size, DEFAULT_INCREMENT, kind, printmode, accMode, memMode, startDevice, endDevice);
}
///////////////////////////////////////////////////////////////////////
//Run a range mode bandwidth test
//////////////////////////////////////////////////////////////////////
function testBandwidthRange(start, end, increment,
memCpyKind, accMode, memMode,
startDevice, endDevice)
{
//count the number of copies we're going to run
var count = 1 + ((end - start) / increment);
var memSizes=new Array();
var bandwidths=new Array();
// Before calculating the cumulative bandwidth, initialize bandwidths array to NULL
for (var i = 0; i < count; i++)
bandwidths[i] = 0.0;
// Use the device asked by the user
for (var d = startDevice; d <= endDevice; d++)
{
// Allocate command queue for the device (dealloc first if already allocated)
createQueue(d);
//run each of the copies
for(var i = 0; i < count; i++)
{
memSizes[i] = start + i * increment;
switch(memCpyKind)
{
case DEVICE_TO_HOST: bandwidths[i] += testDeviceToHostTransfer(memSizes[i], accMode, memMode);
break;
case HOST_TO_DEVICE: bandwidths[i] += testHostToDeviceTransfer(memSizes[i], accMode, memMode);
break;
case DEVICE_TO_DEVICE: bandwidths[i] += testDeviceToDeviceTransfer(memSizes[i]);
break;
}
}
} // Complete the bandwidth computation on all the devices
printResults(memSizes, bandwidths, count, memCpyKind, accMode, memMode, (1 + endDevice - startDevice));
//clean up
}
/////////////////////////////////////////////////////////
//print results in an easily read format
////////////////////////////////////////////////////////
function printResults(memSizes, bandwidths, count, kind, accMode, memMode, iNumDevs)
{
// log config information
var str="";
if (kind == DEVICE_TO_DEVICE) {
str += "Device -> Device Bandwidth, "+iNumDevs+" Device(s)";
}
else {
str += (kind == DEVICE_TO_HOST) ? "Device -> Host" : "Host -> Device";
str += " Bandwidth, "+iNumDevs+" Device(s), ";
str += (memMode == PAGEABLE) ? "Paged memory" : "Pinned memory";
str += (accMode == DIRECT) ? ", direct access\n" : ", mapped access";
}
log(str);
log(" Transfer Size (Bytes)\tBandwidth(MB/s)");
for(var i = 0; i < count; i++)
log(" "+memSizes[i]+"\t\t\t"+((memSizes[i] < 10000)? "\t" : "")+ bandwidths[i]);
log();
}
///////////////////////////////////////////////////////////////////////////////
//test the bandwidth of a device to host memcopy of a specific size
///////////////////////////////////////////////////////////////////////////////
function testDeviceToHostTransfer(memSize, accMode, memMode)
{
var elapsedTimeInSec = 0.0;
var bandwidthInMBs = 0.0;
var cmPinnedData = null;
var cmDevData = null;
//allocate and init host memory, pinned or conventional
if(memMode == PINNED) {
// Create a host buffer
cmPinnedData = ctx.createBuffer(WebCL.MEM_READ_WRITE | WebCL.MEM_ALLOC_HOST_PTR, memSize);
// Get a mapped pointer
h_data = cqCommandQueue.enqueueMapBuffer(cmPinnedData, WebCL.TRUE, WebCL.MAP_WRITE, 0, memSize);
//initialize
for(var i = 0; i < memSize; i++)
h_data[i] = (i & 0xff);
// unmap and make data in the host buffer valid
cqCommandQueue.enqueueUnmapMemObject(cmPinnedData, h_data);
}
else
{
// standard host alloc
h_data = new Uint8Array(memSize);
//initialize
for(var i = 0; i < memSize; i++)
h_data[i] = (i & 0xff);
}
// allocate device memory
cmDevData = ctx.createBuffer(WebCL.MEM_READ_WRITE, memSize);
// initialize device memory
if(memMode == PINNED) {
// Get a mapped pointer
h_data = cqCommandQueue.enqueueMapBuffer(cmPinnedData, WebCL.TRUE, WebCL.MAP_WRITE, 0, memSize);
cqCommandQueue.enqueueWriteBuffer(cmDevData, WebCL.FALSE, 0, memSize, h_data);
}
else {
ciErrNum = cqCommandQueue.enqueueWriteBuffer(cmDevData, WebCL.FALSE, 0, memSize, h_data);
}
// Sync queue to host, start timer 0, and copy data from GPU to Host
cqCommandQueue.finish();
var start=new Date();
if(accMode == DIRECT) {
// DIRECT: API access to device buffer
for(var i = 0; i < MEMCOPY_ITERATIONS; i++) {
ciErrNum = cqCommandQueue.enqueueReadBuffer(cmDevData, WebCL.FALSE, 0, memSize, h_data);
}
cqCommandQueue.finish();
}
else {
// MAPPED: mapped pointers to device buffer for conventional pointer access
var dm_idata = cqCommandQueue.enqueueMapBuffer(cmDevData, WebCL.TRUE, WebCL.MAP_WRITE, 0, memSize);
for(var i = 0; i < MEMCOPY_ITERATIONS; i++) {
for(var j=0;j<memSize;++j)
h_data[j]=dm_idata[j];
}
cqCommandQueue.enqueueUnmapMemObject(cmDevData, dm_idata);
}
//get the the elapsed time in seconds
var elapsedTimeInSec = new Date()-start;
//calculate bandwidth in MB/s
bandwidthInMBs = (memSize * MEMCOPY_ITERATIONS) / (elapsedTimeInSec * (1 << 20));
//clean up memory
//if(cmDevData) cmDevData.release();
if(cmPinnedData) {
cqCommandQueue.enqueueUnmapMemObject(cmPinnedData, h_data);
//cmPinnedData.release();
}
h_data = null;
return bandwidthInMBs;
}
///////////////////////////////////////////////////////////////////////////////
//test the bandwidth of a device to host memcopy of a specific size
///////////////////////////////////////////////////////////////////////////////
function testHostToDeviceTransfer(memSize, accMode, memMode) {
var elapsedTimeInSec = 0.0;
var bandwidthInMBs = 0.0;
var cmPinnedData = null;
var cmDevData = null;
// Allocate and init host memory, pinned or conventional
if(memMode == PINNED)
{
// Create a host buffer
cmPinnedData = ctx.createBuffer(WebCL.MEM_READ_WRITE | WebCL.MEM_ALLOC_HOST_PTR, memSize);
// Get a mapped pointer
h_data = cqCommandQueue.enqueueMapBuffer(cmPinnedData, WebCL.TRUE, WebCL.MAP_WRITE, 0, memSize);
// initialize
for(var i = 0; i < memSize; i++) {
h_data[i] = (i & 0xff);
}
// unmap and make data in the host buffer valid
cqCommandQueue.enqueueUnmapMemObject(cmPinnedData, h_data);
h_data = null; // buffer is unmapped
}
else {
// standard host alloc
h_data = new Uint8Array(memSize);
// initialize
for(var i = 0; i < memSize; i++) {
h_data[i] = (i & 0xff);
}
}
// allocate device memory
cmDevData = ctx.createBuffer(WebCL.MEM_READ_WRITE, memSize);
// Sync queue to host, start timer 0, and copy data from Host to GPU
cqCommandQueue.finish();
var start=new Date();
if(accMode == DIRECT) {
if(memMode == PINNED) {
// Get a mapped pointer
h_data = cqCommandQueue.enqueueMapBuffer(cmPinnedData, WebCL.TRUE, WebCL.MAP_READ, 0, memSize);
}
// DIRECT: API access to device buffer
for(var i = 0; i < MEMCOPY_ITERATIONS; i++) {
ciErrNum = cqCommandQueue.enqueueWriteBuffer(cmDevData, WebCL.FALSE, 0, memSize, h_data);
}
cqCommandQueue.finish();
}
else {
// MAPPED: mapped pointers to device buffer and conventional pointer access
var dm_idata = cqCommandQueue.enqueueMapBuffer(cmDevData, WebCL.TRUE, WebCL.MAP_WRITE, 0, memSize);
if(memMode == PINNED ) {
h_data = cqCommandQueue.enqueueMapBuffer(cmPinnedData, WebCL.TRUE, WebCL.MAP_READ, 0, memSize);
}
for(var i = 0; i < MEMCOPY_ITERATIONS; i++) {
for(var j=0;j<memSize;j++)
dm_idata[j]=h_data[j];
}
ciErrNum = cqCommandQueue.enqueueUnmapMemObject(cmDevData, dm_idata);
}
// get the the elapsed time in seconds
var elapsedTimeInSec = new Date()-start;
// calculate bandwidth in MB/s
bandwidthInMBs = (memSize * MEMCOPY_ITERATIONS)/(elapsedTimeInSec * (1 << 20));
// clean up memory
//if(cmDevData) cmDevData.release();
if(cmPinnedData) {
cqCommandQueue.enqueueUnmapMemObject(cmPinnedData, h_data);
//cmPinnedData.release();
}
h_data = null;
return bandwidthInMBs;
}
///////////////////////////////////////////////////////////////////////////////
//test the bandwidth of a device to host memcopy of a specific size
///////////////////////////////////////////////////////////////////////////////
function testDeviceToDeviceTransfer(memSize)
{
var elapsedTimeInSec = 0.0;
var bandwidthInMBs = 0.0;
//allocate host memory
var h_idata = new Uint8Array(memSize);
//initialize the memory
for(var i = 0; i < memSize; i++)
h_idata[i] = (i & 0xff);
// allocate device input and output memory and initialize the device input memory
var d_idata = ctx.createBuffer(WebCL.MEM_READ_ONLY, memSize);
var d_odata = ctx.createBuffer(WebCL.MEM_WRITE_ONLY, memSize);
cqCommandQueue.enqueueWriteBuffer(d_idata, WebCL.TRUE, 0, memSize, h_idata);
// Sync queue to host, start timer 0, and copy data from one GPU buffer to another GPU bufffer
cqCommandQueue.finish();
var start=new Date();
for(var i = 0; i < MEMCOPY_ITERATIONS; i++)
{
cqCommandQueue.enqueueCopyBuffer(d_idata, d_odata, 0, 0, memSize);
}
// Sync with GPU
cqCommandQueue.finish();
//get the the elapsed time in seconds
elapsedTimeInSec = new Date()-start;
// Calculate bandwidth in MB/s
// This is for kernels that read and write GMEM simultaneously
// Obtained Throughput for unidirectional block copies will be 1/2 of this #
bandwidthInMBs = 2.0 * (memSize * MEMCOPY_ITERATIONS)/(elapsedTimeInSec * (1 << 20));
//clean up memory on host and device
//free(h_idata);
//d_idata.release();
//d_odata.release();
return bandwidthInMBs;
}

@@ -34,3 +34,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var cl = new WebCL();
var completed_kernel=false, completed_read=false;

@@ -55,3 +54,3 @@

var check = cl.TRUE;
var check = WebCL.TRUE;
//var str="";

@@ -61,3 +60,3 @@ for(i=0; i<4096; i++) {

if(data[i] != 5.0) {
check = cl.FALSE;
check = WebCL.FALSE;
break;

@@ -89,13 +88,13 @@ }

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_GPU);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
var context=cl.createContext({
var context=WebCL.createContext({
devices: device,

@@ -129,3 +128,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -144,3 +143,3 @@ exit(1);

try {
data_buffer = context.createBuffer(cl.MEM_WRITE_ONLY, 4096*4);
data_buffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, 4096*4);
} catch(ex) {

@@ -161,3 +160,3 @@ log("Couldn't create a buffer. "+ex);

try {
queue = context.createCommandQueue(device, 0);
queue = context.createCommandQueue(device,0);
} catch(ex) {

@@ -170,3 +169,3 @@ log("Couldn't create a command queue. "+ex);

try {
kernel_event=new cl.WebCLEvent();
kernel_event=new WebCL.WebCLEvent();
queue.enqueueTask(kernel , null, kernel_event);

@@ -181,3 +180,3 @@ } catch(ex) {

try {
read_event=new cl.WebCLEvent();
read_event=new WebCL.WebCLEvent();
queue.enqueueReadBuffer(data_buffer, false, 0, 4096*4, data, null, read_event);

@@ -191,3 +190,3 @@ } catch(ex) {

try {
kernel_event.setCallback(cl.COMPLETE, kernel_complete, "The kernel finished successfully.");
kernel_event.setCallback(WebCL.COMPLETE, kernel_complete, "The kernel finished successfully.");
} catch(ex) {

@@ -197,3 +196,3 @@ log("Couldn't set callback for event. "+ex);

}
read_event.setCallback(cl.COMPLETE, read_complete, data);
read_event.setCallback(WebCL.COMPLETE, read_complete, data);

@@ -200,0 +199,0 @@ queue.finish(); // wait for everything to finish

@@ -35,3 +35,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

/* CL objects */
var cl = new WebCL();
var /* WebCLPlatform */ platform;

@@ -63,3 +62,3 @@ var /* WebCLDevice */ device;

var check = cl.TRUE;
var check = WebCL.TRUE;
//var str="";

@@ -69,3 +68,3 @@ for(i=0; i<4096; i++) {

if(data[i] != 5.0) {
check = cl.FALSE;
check = WebCL.FALSE;
break;

@@ -91,3 +90,3 @@ }

try {
data_buffer = context.createBuffer(cl.MEM_WRITE_ONLY, 4096*4);
data_buffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, 4096*4);
} catch(ex) {

@@ -116,3 +115,3 @@ log("Couldn't create a buffer. "+ex);

try {
kernel_event=new cl.WebCLEvent();
kernel_event=new WebCL.WebCLEvent();
queue.enqueueTask(kernel , null, kernel_event);

@@ -127,3 +126,3 @@ } catch(ex) {

try {
read_event=new cl.WebCLEvent();
read_event=new WebCL.WebCLEvent();
queue.enqueueReadBuffer(data_buffer, false, 0, 4096*4, data, null, read_event);

@@ -137,3 +136,3 @@ } catch(ex) {

try {
kernel_event.setCallback(cl.COMPLETE, kernel_complete, "The kernel finished successfully.");
kernel_event.setCallback(WebCL.COMPLETE, kernel_complete, "The kernel finished successfully.");
} catch(ex) {

@@ -143,3 +142,3 @@ log("Couldn't set callback for event. "+ex);

}
read_event.setCallback(cl.COMPLETE, read_complete, data);
read_event.setCallback(WebCL.COMPLETE, read_complete, data);

@@ -155,13 +154,13 @@ queue.finish(); // wait for everything to finish

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_GPU);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
context=cl.createContext({
context=WebCL.createContext({
devices: device,

@@ -194,3 +193,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -197,0 +196,0 @@ exit(1);

@@ -125,6 +125,6 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

var sz=0;
for(var i=0,i<fields;++i) {
for(var i=0;i<fields;++i) {
var field = cstruct[i];
var arr=[],k=0;
for(var j=0,l>field.length;j<l;++j) {
for(var j=0,l=field.length;j<l;++j) {
arr[k++]=field[j];

@@ -131,0 +131,0 @@ }

@@ -48,3 +48,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

// cl stuff
var cl = new WebCL();
var /* cl_context */ ComputeContext;

@@ -54,3 +53,3 @@ var /* cl_command_queue */ ComputeCommands;

var /* cl_device_id */ ComputeDevice;
var /* cl_device_type */ ComputeDeviceType = cl.DEVICE_TYPE_GPU;
var /* cl_device_type */ ComputeDeviceType = WebCL.DEVICE_TYPE_GPU;
var /* cl_image */ ComputePBO;

@@ -85,3 +84,3 @@ var /* cl_kernel */ ckCompute;

var err = init_gl(canvas);
if (err != cl.SUCCESS)
if (err != WebCL.SUCCESS)
return err;

@@ -97,3 +96,3 @@

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -126,3 +125,3 @@

try {
ComputePBO = ComputeContext.createFromGLTexture2D(cl.MEM_WRITE_ONLY, gl.TEXTURE_2D, 0, TextureId);
ComputePBO = ComputeContext.createFromGLTexture(WebCL.MEM_WRITE_ONLY, gl.TEXTURE_2D, 0, TextureId);
}

@@ -269,3 +268,3 @@ catch(ex) {

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -281,7 +280,7 @@

// Pick platform
var platformList = cl.getPlatforms();
var platformList = WebCL.getPlatforms();
var platform = platformList[0];
// create the OpenCL context
ComputeContext = cl.createContext({
ComputeContext = WebCL.createContext({
deviceType: ComputeDeviceType,

@@ -291,3 +290,3 @@ shareGroup: gl,

var device_ids = ComputeContext.getInfo(cl.CONTEXT_DEVICES);
var device_ids = ComputeContext.getInfo(WebCL.CONTEXT_DEVICES);
if (!device_ids) {

@@ -300,3 +299,3 @@ alert("Error: Failed to retrieve compute devices for context!");

for(var i=0,l=device_ids.length;i<l;++i ) {
device_type = device_ids[i].getInfo(cl.DEVICE_TYPE);
device_type = device_ids[i].getInfo(WebCL.DEVICE_TYPE);
if (device_type == ComputeDeviceType) {

@@ -324,14 +323,14 @@ ComputeDevice = device_ids[i];

//
var vendor_name = ComputeDevice.getInfo(cl.DEVICE_VENDOR);
var device_name = ComputeDevice.getInfo(cl.DEVICE_NAME);
var vendor_name = ComputeDevice.getInfo(WebCL.DEVICE_VENDOR);
var device_name = ComputeDevice.getInfo(WebCL.DEVICE_NAME);
log("Connecting to " + vendor_name + " " + device_name);
if (!ComputeDevice.getInfo(cl.DEVICE_IMAGE_SUPPORT)) {
if (!ComputeDevice.getInfo(WebCL.DEVICE_IMAGE_SUPPORT)) {
log("Application requires images: Images not supported on this device.");
return cl.IMAGE_FORMAT_NOT_SUPPORTED;
return WebCL.IMAGE_FORMAT_NOT_SUPPORTED;
}
err = init_cl_buffers();
if (err != cl.SUCCESS) {
if (err != WebCL.SUCCESS) {
log("Failed to create compute result! Error " + err);

@@ -342,3 +341,3 @@ return err;

err = init_cl_kernels();
if (err != cl.SUCCESS) {
if (err != WebCL.SUCCESS) {
log("Failed to setup compute kernel! Error " + err);

@@ -348,3 +347,3 @@ return err;

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -381,3 +380,3 @@

alert("Error: Failed to build program executable!\n"
+ ComputeProgram.getBuildInfo(ComputeDevice, cl.PROGRAM_BUILD_LOG));
+ ComputeProgram.getBuildInfo(ComputeDevice, WebCL.PROGRAM_BUILD_LOG));
return -1;

@@ -398,7 +397,7 @@ }

//
max_workgroup_size = ckCompute.getWorkGroupInfo(ComputeDevice, cl.KERNEL_WORK_GROUP_SIZE);
max_workitem_sizes=ComputeDevice.getInfo(cl.DEVICE_MAX_WORK_ITEM_SIZES);
max_workgroup_size = ckCompute.getWorkGroupInfo(ComputeDevice, WebCL.KERNEL_WORK_GROUP_SIZE);
max_workitem_sizes=ComputeDevice.getInfo(WebCL.DEVICE_MAX_WORK_ITEM_SIZES);
log(' max workgroup size: '+max_workgroup_size);
log(' max workitem sizes: '+max_workitem_sizes);
return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -418,3 +417,3 @@

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -425,3 +424,3 @@

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -502,3 +501,3 @@

//DrawText(TextOffset[0], TextOffset[1], 1, (Animated == 0) ? "Press space to animate" : " ");
return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -548,3 +547,3 @@

// Set global and local work sizes for row kernel
var local = [ 32, max_workgroup_size/32 ];
var local = [ 16, max_workgroup_size/16 ];
var global = [ clu.DivUp(TextureWidth, local[0]) * local[0],

@@ -567,3 +566,3 @@ clu.DivUp(TextureHeight, local[1]) * local[1] ];

return cl.SUCCESS;
return WebCL.SUCCESS;
}

@@ -573,3 +572,3 @@

// init window
if(initialize()==cl.SUCCESS) {
if(initialize()==WebCL.SUCCESS) {
function update() {

@@ -576,0 +575,0 @@ display();

@@ -41,3 +41,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

/* CL objects */
var cl = new WebCL();
var /* WebCLPlatform */ platform;

@@ -71,13 +70,13 @@ var /* WebCLDevice */ device;

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
var context=cl.createContext({
var context=WebCL.createContext({
devices: device,

@@ -113,3 +112,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -128,3 +127,3 @@ exit(1);

try {
data_buffer = context.createBuffer(cl.MEM_READ_WRITE | cl.MEM_COPY_HOST_PTR, data.byteLength, data);
data_buffer = context.createBuffer(WebCL.MEM_READ_WRITE | WebCL.MEM_COPY_HOST_PTR, data.byteLength, data);
} catch(ex) {

@@ -138,3 +137,3 @@ log("Couldn't create a buffer. "+ex);

kernel.setArg(0, data_buffer);
kernel.setArg(1, num_ints, cl.type.INT);
kernel.setArg(1, num_ints, WebCL.type.INT);
} catch(ex) {

@@ -147,3 +146,3 @@ log("Couldn't set a kernel argument. "+ex);

try {
queue = context.createCommandQueue(device, cl.QUEUE_PROFILING_ENABLE);
queue = context.createCommandQueue(device, WebCL.QUEUE_PROFILING_ENABLE);
} catch(ex) {

@@ -154,3 +153,3 @@ log("Couldn't create a command queue for profiling. "+ex);

var total_time = 0, time_start, time_end;
prof_event=new cl.WebCLEvent();
prof_event=new WebCL.WebCLEvent();

@@ -169,4 +168,4 @@ for(var i=0;i<NUM_ITERATIONS;i++) {

time_start = prof_event.getProfilingInfo(cl.PROFILING_COMMAND_START);
time_end = prof_event.getProfilingInfo(cl.PROFILING_COMMAND_END);
time_start = prof_event.getProfilingInfo(WebCL.PROFILING_COMMAND_START);
time_end = prof_event.getProfilingInfo(WebCL.PROFILING_COMMAND_END);
//log("time: start="+time_start+" end="+time_end);

@@ -173,0 +172,0 @@ total_time += time_end - time_start;

@@ -41,3 +41,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

/* CL objects */
var cl = new WebCL();
var /* WebCLPlatform */ platform;

@@ -64,13 +63,13 @@ var /* WebCLDevice */ device;

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
var context=cl.createContext({
var context=WebCL.createContext({
devices: device,

@@ -102,3 +101,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -117,3 +116,3 @@ exit(1);

try {
data_buffer = context.createBuffer(cl.MEM_WRITE_ONLY, NUM_BYTES);
data_buffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, NUM_BYTES);
} catch(ex) {

@@ -134,7 +133,7 @@ log("Couldn't create a buffer. "+ex);

var num_vectors = NUM_BYTES/16;
kernel.setArg(1, num_vectors, cl.type.INT);
kernel.setArg(1, num_vectors, WebCL.type.INT);
/* Create a command queue */
try {
queue = context.createCommandQueue(device, cl.QUEUE_PROFILING_ENABLE);
queue = context.createCommandQueue(device, WebCL.QUEUE_PROFILING_ENABLE);
} catch(ex) {

@@ -145,3 +144,3 @@ log("Couldn't create a command queue for profiling. "+ex);

var total_time = 0, time_start, time_end;
var prof_event=new cl.WebCLEvent();
var prof_event=new WebCL.WebCLEvent();
var loop_time=0, loop_start, loop_end;

@@ -172,3 +171,3 @@

try {
mapped_memory = queue.enqueueMapBuffer(data_buffer, true, cl.MAP_READ, 0, data.byteLength, null, prof_event);
mapped_memory = queue.enqueueMapBuffer(data_buffer, true, WebCL.MAP_READ, 0, data.byteLength, null, prof_event);
if(mapped_memory[0]!=5) {

@@ -184,4 +183,4 @@ Throw("Kernel didn't work or mapping is wrong");

/* Get profiling information */
time_start = prof_event.getProfilingInfo(cl.PROFILING_COMMAND_START);
time_end = prof_event.getProfilingInfo(cl.PROFILING_COMMAND_END);
time_start = prof_event.getProfilingInfo(WebCL.PROFILING_COMMAND_START);
time_end = prof_event.getProfilingInfo(WebCL.PROFILING_COMMAND_END);
total_time += time_end - time_start;

@@ -188,0 +187,0 @@

@@ -36,3 +36,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

/* CL objects */
var cl = new WebCL();
var /* WebCLPlatform */ platform;

@@ -57,13 +56,13 @@ var /* WebCLDevice */ device;

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_DEFAULT);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
var context=cl.createContext({
var context=WebCL.createContext({
devices: device,

@@ -166,3 +165,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -181,3 +180,3 @@ exit(1);

try {
data_buffer = context.createBuffer(cl.MEM_WRITE_ONLY, NUM_ELEMS*Uint32Array.BYTES_PER_ELEMENT);
data_buffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, NUM_ELEMS*Uint32Array.BYTES_PER_ELEMENT);
} catch(ex) {

@@ -189,3 +188,3 @@ log("Couldn't create a buffer. "+ex);

try {
ret_buffer = context.createBuffer(cl.MEM_WRITE_ONLY, 1*Uint32Array.BYTES_PER_ELEMENT);
ret_buffer = context.createBuffer(WebCL.MEM_WRITE_ONLY, 1*Uint32Array.BYTES_PER_ELEMENT);
} catch(ex) {

@@ -199,3 +198,3 @@ log("Couldn't create a buffer. "+ex);

kernel.setArg(0, data_buffer);
kernel.setArg(1, NUM_ELEMS, cl.type.UINT); /* Tell kernel number of elements */
kernel.setArg(1, NUM_ELEMS, WebCL.type.UINT); /* Tell kernel number of elements */
kernel.setArg(2, ret_buffer); /* Pass pointer to returned number of values */

@@ -202,0 +201,0 @@

@@ -41,3 +41,2 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

/* CL objects */
var cl = new WebCL();
var /* WebCLPlatform */ platform;

@@ -61,13 +60,13 @@ var /* WebCLDevice */ device;

//Pick platform
var platformList=cl.getPlatforms();
var platformList=WebCL.getPlatforms();
platform=platformList[0];
log('using platform: '+platform.getInfo(cl.PLATFORM_NAME));
log('using platform: '+platform.getInfo(WebCL.PLATFORM_NAME));
//Query the set of devices on this platform
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU);
var devices = platform.getDevices(WebCL.DEVICE_TYPE_GPU);
device=devices[0];
log('using device: '+device.getInfo(cl.DEVICE_NAME));
log('using device: '+device.getInfo(WebCL.DEVICE_NAME));
// create GPU context for this platform
var context=cl.createContext({
var context=WebCL.createContext({
devices: device,

@@ -97,3 +96,3 @@ platform: platform

/* Find size of log and print to std output */
var info=program.getBuildInfo(devices[0], cl.PROGRAM_BUILD_LOG);
var info=program.getBuildInfo(devices[0], WebCL.PROGRAM_BUILD_LOG);
log(info);

@@ -112,3 +111,3 @@ exit(1);

try {
data_buffer = context.createBuffer(cl.MEM_READ_WRITE | cl.MEM_COPY_HOST_PTR, 4*Float32Array.BYTES_PER_ELEMENT,data);
data_buffer = context.createBuffer(WebCL.MEM_READ_WRITE | WebCL.MEM_COPY_HOST_PTR, 4*Float32Array.BYTES_PER_ELEMENT,data);
} catch(ex) {

@@ -129,3 +128,3 @@ log("Couldn't create a buffer. "+ex);

try {
queue = context.createCommandQueue(device, cl.QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
queue = context.createCommandQueue(device, WebCL.QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
} catch(ex) {

@@ -146,3 +145,3 @@ log("Couldn't create an out of order command queue, using in-order queue. "+ex);

try {
kernel_event=new cl.WebCLEvent();
kernel_event=new WebCL.WebCLEvent();
queue.enqueueTask(kernel , [user_event], kernel_event);

@@ -156,3 +155,3 @@ } catch(ex) {

try {
read_event=new cl.WebCLEvent();
read_event=new WebCL.WebCLEvent();
queue.enqueueReadBuffer(data_buffer, false, 0, data.byteLength, data, [ kernel_event ], read_event);

@@ -166,3 +165,3 @@ } catch(ex) {

try {
read_event.setCallback(cl.COMPLETE, read_complete, data);
read_event.setCallback(WebCL.COMPLETE, read_complete, data);
} catch(ex) {

@@ -176,3 +175,3 @@ log("Couldn't set callback for read event. "+ex);

/* Set user event to success */
user_event.setUserEventStatus(cl.SUCCESS);
user_event.setUserEventStatus(WebCL.SUCCESS);

@@ -179,0 +178,0 @@ queue.finish();

@@ -31,5 +31,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc.

module.exports = function WebCL() {
return cl;
};
module.exports = cl;

@@ -106,8 +104,5 @@ cl.size = {};

var _unloadCompiler = cl.unloadCompiler;
cl.unloadCompiler = function () {
if (!(arguments.length === 0 )) {
throw new TypeError('Expected unloadCompiler()');
}
return _unloadCompiler();
var _releaseAll = cl.releaseAll;
cl.releaseAll = function () {
return _releaseAll();
}

@@ -118,2 +113,6 @@

//////////////////////////////
cl.WebCLCommandQueue.prototype.release=function () {
return this._release();
}
cl.WebCLCommandQueue.prototype.getInfo=function (param_name) {

@@ -481,2 +480,6 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLContext.prototype.release=function () {
return this._release();
}
cl.WebCLContext.prototype.getInfo=function (param_name) {

@@ -568,3 +571,3 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

cl.WebCLContext.prototype.createFromGLTexture2D=function (flags, texture_target, miplevel, texture) {
cl.WebCLContext.prototype.createFromGLTexture=function (flags, texture_target, miplevel, texture) {
if (!(arguments.length === 4 && typeof flags === 'number' &&

@@ -575,21 +578,14 @@ typeof texture_target ==='number' &&

)) {
throw new TypeError('Expected WebCLContext.createFromGLTexture2D(CLenum flags, GLenum texture_target, GLint miplevel, WebGLTexture2D texture)');
throw new TypeError('Expected WebCLContext.createFromGLTexture(CLenum flags, GLenum texture_target, GLint miplevel, WebGLTexture2D texture)');
}
return this._createFromGLTexture2D(flags, texture_target, miplevel, texture ? texture._ : 0);
return this._createFromGLTexture(flags, texture_target, miplevel, texture ? texture._ : 0);
}
cl.WebCLContext.prototype.createFromGLTexture3D=function (flags, texture_target, miplevel, texture) {
if (!(arguments.length === 4 && typeof flags === 'number' &&
typeof texture_target ==='number' &&
typeof miplevel ==='number' &&
typeof texture ==='object'
)) {
throw new TypeError('Expected WebCLContext.createFromGLTexture3D(CLenum flags, GLenum texture_target, GLint miplevel, WebGLTexture3D texture)');
}
return this._createFromGLTexture3D(flags, texture_target, miplevel, texture ? texture._ : 0);
}
//////////////////////////////
//WebCLDevice object
//////////////////////////////
cl.WebCLDevice.prototype.release=function () {
return this._release();
}
cl.WebCLDevice.prototype.getInfo=function (param_name) {

@@ -612,2 +608,6 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLEvent.prototype.release=function () {
return this._release();
}
cl.WebCLEvent.prototype.getInfo=function (param_name) {

@@ -645,2 +645,6 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLKernel.prototype.release=function () {
return this._release();
}
cl.WebCLKernel.prototype.getInfo=function (param_name) {

@@ -678,2 +682,5 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLMemoryObject.prototype.release=function () {
return this._release();
}

@@ -698,2 +705,6 @@ cl.WebCLMemoryObject.prototype.getInfo=function (param_name) {

cl.WebCLBuffer.prototype.release=function () {
return this._release();
}
cl.WebCLBuffer.prototype.createSubBuffer=function (flags, type, region) {

@@ -710,2 +721,6 @@ if (!(arguments.length === 3 && typeof flags === 'number' && typeof type === 'number' && typeof region === 'object')) {

cl.WebCLImage.prototype.release=function () {
return this._release();
}
cl.WebCLImage.prototype.getInfo=function (param_name) {

@@ -728,2 +743,3 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLPlatform.prototype.getInfo=function (param_name) {

@@ -746,2 +762,6 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLProgram.prototype.release=function () {
return this._release();
}
cl.WebCLProgram.prototype.getInfo=function (param_name) {

@@ -783,2 +803,6 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

//////////////////////////////
cl.WebCLSampler.prototype.release=function () {
return this._release();
}
cl.WebCLSampler.prototype.getInfo=function (param_name) {

@@ -785,0 +809,0 @@ if (!(arguments.length === 1 && typeof param_name === 'number')) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc