node-webcl
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../../../webcl'); | ||
WebCL = require('../../../webcl'); | ||
clu = require('../../../lib/clUtils'); | ||
@@ -43,2 +43,3 @@ util = require('util'); | ||
requestAnimationFrame = document.requestAnimationFrame; | ||
var cl = new WebCL(); | ||
var use_gpu=true; | ||
@@ -314,11 +315,2 @@ | ||
/*pMatrix[0]=pMatrix[5]=pMatrix[15]=1; | ||
pMatrix[10]=-1; | ||
mvMatrix[0]=mvMatrix[5]=mvMatrix[10]=mvMatrix[15]=1;*/ | ||
//gl.enableClientState(gl.VERTEX_ARRAY); | ||
//gl.enableClientState(gl.TEXTURE_COORD_ARRAY); | ||
//gl.vertexPointer(2, gl.FLOAT, 0, VertexPos); | ||
gl.activeTexture(gl.TEXTURE0); | ||
@@ -760,3 +752,5 @@ return cl.SUCCESS; | ||
} | ||
// sync GL | ||
gl.finish(); | ||
try { | ||
@@ -793,2 +787,4 @@ ComputeCommands.enqueueAcquireGLObjects(ComputeImage); | ||
// sync CL | ||
ComputeCommands.finish(); | ||
return cl.SUCCESS; | ||
@@ -795,0 +791,0 @@ }, |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -38,2 +38,4 @@ util = require('util'); | ||
var cl=new WebCL(); | ||
//First check if the webcl extension is installed at all | ||
@@ -82,3 +84,3 @@ if (cl == undefined) { | ||
//Query the set of GPU devices on this platform | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU); | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_ALL); | ||
log(" # of Devices Available = "+devices.length); | ||
@@ -109,9 +111,10 @@ var uiTargetDevice = clu.clamp(uiTargetDevice, 0, (devices.length - 1)); | ||
var InputFormat= { | ||
order : cl.RGBA, | ||
data_type : cl.UNSIGNED_INT8 | ||
order : cl.RGBA, | ||
data_type : cl.UNSIGNED_INT8, | ||
size : [ image.width, image.height ], | ||
rowPitch : image.pitch | ||
}; | ||
//2D Image (Texture) on device | ||
cmDevBufIn = context.createImage2D(cl.MEM_READ_ONLY | cl.MEM_USE_HOST_PTR, InputFormat, | ||
image.width, image.height, image.pitch /*image.width*Uint32Array.BYTES_PER_ELEMENT*/, image.buffer); | ||
cmDevBufIn = context.createImage(cl.MEM_READ_ONLY | cl.MEM_USE_HOST_PTR, InputFormat, image.buffer); | ||
@@ -148,7 +151,3 @@ RowSampler = context.createSampler(false, cl.ADDRESS_CLAMP, cl.FILTER_NEAREST); | ||
var uiOutput=new Uint8Array(szBuffBytes); | ||
queue.enqueueReadBuffer(cmDevBufOut, cl.TRUE, { | ||
offset: 0, | ||
size: szBuffBytes, | ||
buffer: uiOutput | ||
}); | ||
queue.enqueueReadBuffer(cmDevBufOut, cl.TRUE, 0, szBuffBytes, uiOutput); | ||
@@ -155,0 +154,0 @@ // PNG uses 32-bit images, JPG can only work on 24-bit images |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -43,3 +43,3 @@ util = require('util'); | ||
var use_gpu = true; | ||
var use_gpu = false; | ||
var image; | ||
@@ -52,2 +52,3 @@ | ||
// cl stuff | ||
var cl = new WebCL(); | ||
var /* cl_context */ ComputeContext; | ||
@@ -333,3 +334,3 @@ var /* cl_command_queue */ ComputeCommands; | ||
log('init CL'); | ||
ComputeDeviceType = device_type ? cl.DEVICE_TYPE_GPU : cl.DEVICE_TYPE_CPU; | ||
ComputeDeviceType = device_type ? cl.DEVICE_TYPE_GPU : cl.DEVICE_TYPE_DEFAULT; | ||
@@ -495,6 +496,7 @@ // Pick platform | ||
order : cl.RGBA, | ||
data_type : cl.UNSIGNED_INT8 | ||
data_type : cl.UNSIGNED_INT8, | ||
size: [ image.width, image.height ], | ||
rowPitch: image.pitch | ||
}; | ||
ComputeTexture = ComputeContext.createImage2D(cl.MEM_READ_ONLY | ||
| cl.MEM_USE_HOST_PTR, InputFormat, image.width, image.height, image.pitch, image); | ||
ComputeTexture = ComputeContext.createImage(cl.MEM_READ_ONLY | cl.MEM_USE_HOST_PTR, InputFormat, image); | ||
if (!ComputeTexture) { | ||
@@ -501,0 +503,0 @@ alert("Error: Failed to create a Image2D on device"); |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -36,2 +36,3 @@ util = require('util'); | ||
var cl=new WebCL(); | ||
@@ -48,4 +49,17 @@ //list of platforms | ||
log(" PLATFORM_VENDOR: \t"+p.getInfo(cl.PLATFORM_VENDOR)); | ||
log(" PLATFORM_EXTENSIONS: \t"+p.getInfo(cl.PLATFORM_EXTENSIONS)); | ||
// 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); | ||
if (platform_ext_string.length > 0) | ||
{ | ||
var extensions=platform_ext_string.trim().split(' '); | ||
for(var i=0;i<extensions.length;i++) { | ||
log("\t\t\t\t\t"+extensions[i]); | ||
} | ||
} | ||
else | ||
log("\t\t\t\t\tNone"); | ||
log(); | ||
//list for devices for a platform | ||
@@ -134,10 +148,15 @@ log("OpenCL Device Info:\n"); | ||
var type=parseInt(device.getInfo(cl.DEVICE_TYPE)); | ||
var type_strings=[]; | ||
if( type & cl.DEVICE_TYPE_CPU ) | ||
log(" DEVICE_TYPE:\t\t\tDEVICE_TYPE_CPU"); | ||
type_strings.push("cpu"); | ||
if( type & cl.DEVICE_TYPE_GPU ) | ||
log(" DEVICE_TYPE:\t\t\tDEVICE_TYPE_GPU"); | ||
type_strings.push("gpu"); | ||
if( type & cl.DEVICE_TYPE_ACCELERATOR ) | ||
log(" DEVICE_TYPE:\t\t\tDEVICE_TYPE_ACCELERATOR"); | ||
type_strings.push("accelerator"); | ||
if( type & cl.DEVICE_TYPE_DEFAULT ) | ||
log(" DEVICE_TYPE:\t\t\tDEVICE_TYPE_DEFAULT"); | ||
type_strings.push("default"); | ||
// FIXME: 1.2 | ||
//if( type & cl.DEVICE_TYPE_CUSTOM ) | ||
// type_strings.push("custom"); | ||
log(" DEVICE_TYPE:\t\t\t"+type_strings.join(" ")); | ||
@@ -148,4 +167,4 @@ var compute_units=0; | ||
var workitem_size=device.getInfo(cl.DEVICE_MAX_WORK_ITEM_SIZES); | ||
log(" DEVICE_MAX_WORK_ITEM_SIZES:\t"+workitem_size[0]+" / "+workitem_size[1]+" / "+workitem_size[2]); | ||
var workitem_sizes=device.getInfo(cl.DEVICE_MAX_WORK_ITEM_SIZES); | ||
log(" DEVICE_MAX_WORK_ITEM_SIZES:\t"+workitem_sizes.join(" / ")); | ||
@@ -158,3 +177,12 @@ log(" DEVICE_MAX_WORK_GROUP_SIZE:\t"+device.getInfo(cl.DEVICE_MAX_WORK_GROUP_SIZE)); | ||
log(" DEVICE_ERROR_CORRECTION_SUPPORT:\t"+(device.getInfo(cl.DEVICE_ERROR_CORRECTION_SUPPORT) == cl.TRUE ? "yes" : "no")); | ||
log(" DEVICE_LOCAL_MEM_TYPE:\t\t"+(device.getInfo(cl.DEVICE_LOCAL_MEM_TYPE) == 1 ? "local" : "global")); | ||
// DEVICE_LOCAL_MEM_TYPE | ||
var local_mem_type=device.getInfo(cl.DEVICE_LOCAL_MEM_TYPE); | ||
if( cache_type === cl.NONE ) | ||
log(" DEVICE_LOCAL_MEM_TYPE:\t\tNONE"); | ||
if( cache_type === cl.LOCAL ) | ||
log(" DEVICE_LOCAL_MEM_TYPE:\t\tLOCAL"); | ||
if( cache_type === cl.GLOBAL ) | ||
log(" DEVICE_LOCAL_MEM_TYPE:\t\tGLOBAL"); | ||
log(" DEVICE_LOCAL_MEM_SIZE:\t\t"+(device.getInfo(cl.DEVICE_LOCAL_MEM_SIZE) / 1024)+" KBytes"); | ||
@@ -170,8 +198,11 @@ log(" DEVICE_MAX_CONSTANT_BUFFER_SIZE:\t"+(device.getInfo(cl.DEVICE_MAX_CONSTANT_BUFFER_SIZE) / 1024)+" KBytes"); | ||
var cache_type=device.getInfo(cl.DEVICE_GLOBAL_MEM_CACHE_TYPE); | ||
if( cache_type & cl.NONE) | ||
if( cache_type === cl.NONE ) | ||
log(" DEVICE_GLOBAL_MEM_CACHE_TYPE:\t\tNONE"); | ||
if( cache_type & cl.READ_ONLY_CACHE) | ||
if( cache_type === cl.READ_ONLY_CACHE ) | ||
log(" DEVICE_GLOBAL_MEM_CACHE_TYPE:\t\tREAD_ONLY_CACHE"); | ||
if( cache_type & cl.READ_WRITE_CACHE) | ||
if( cache_type === cl.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"); | ||
@@ -185,10 +216,20 @@ log(" DEVICE_MAX_CONSTANT_ARGS:\t"+device.getInfo(cl.DEVICE_MAX_CONSTANT_ARGS)); | ||
log(" DEVICE_COMPILER_AVAILABLE:\t"+device.getInfo(cl.DEVICE_COMPILER_AVAILABLE)); | ||
log(" DEVICE_EXECUTION_CAPABILITIES:\t"+device.getInfo(cl.DEVICE_EXECUTION_CAPABILITIES)); | ||
// DEVICE_EXECUTION_CAPABILITIES | ||
var execution_capabilities=device.getInfo(cl.DEVICE_EXECUTION_CAPABILITIES); | ||
var execution_capabilities_strings=[]; | ||
if( execution_capabilities & cl.EXEC_KERNEL ) | ||
execution_capabilities_strings.push("kernel"); | ||
if( execution_capabilities & cl.EXEC_NATIVE_KERNEL ) | ||
execution_capabilities_strings.push("native-kernel"); | ||
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_strings=[]; | ||
if( queue_properties & cl.QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ) | ||
log(" DEVICE_QUEUE_PROPERTIES:\t\tQUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE"); | ||
queue_properties_strings.push("out-of-order-exec-mode"); | ||
if( queue_properties & cl.QUEUE_PROFILING_ENABLE ) | ||
log(" DEVICE_QUEUE_PROPERTIES:\t\tQUEUE_PROFILING_ENABLE"); | ||
queue_properties_strings.push("profiling"); | ||
log(" DEVICE_QUEUE_PROPERTIES:\t\t"+queue_properties_strings.join(" ")); | ||
@@ -200,12 +241,28 @@ // image support | ||
// DEVICE_SINGLE_FP_CONFIG | ||
var fp_config=device.getInfo(cl.DEVICE_SINGLE_FP_CONFIG); | ||
log(" DEVICE_SINGLE_FP_CONFIG:\t\t"+ | ||
(fp_config & cl.FP_DENORM ? "denorms " : "")+ | ||
(fp_config & cl.FP_INF_NAN ? "INF-quietNaNs " : "")+ | ||
(fp_config & cl.FP_ROUND_TO_NEAREST ? "round-to-nearest " : "")+ | ||
(fp_config & cl.FP_ROUND_TO_ZERO ? "round-to-zero " : "")+ | ||
(fp_config & cl.FP_ROUND_TO_INF ? "round-to-inf " : "")+ | ||
(fp_config & cl.FP_FMA ? "fma " : "")); | ||
function fp_config_info(type, name) | ||
{ | ||
// DEVICE_*_FP_CONFIG | ||
var fp_config=device.getInfo(type); | ||
var fp_config_strings=[]; | ||
if( fp_config & cl.FP_DENORM ) | ||
fp_config_strings.push("denorms"); | ||
if( fp_config & cl.FP_INF_NAN ) | ||
fp_config_strings.push("INF-quietNaNs"); | ||
if( fp_config & cl.FP_ROUND_TO_NEAREST ) | ||
fp_config_strings.push("round-to-nearest"); | ||
if( fp_config & cl.FP_ROUND_TO_ZERO ) | ||
fp_config_strings.push("round-to-zero"); | ||
if( fp_config & cl.FP_ROUND_TO_INF ) | ||
fp_config_strings.push("round-to-inf"); | ||
if( fp_config & cl.FP_FMA ) | ||
fp_config_strings.push("fma"); | ||
if( fp_config & cl.FP_SOFT_FLOAT ) | ||
fp_config_strings.push("soft-float"); | ||
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"); | ||
log("\n DEVICE_IMAGE <dim>"); | ||
@@ -224,3 +281,3 @@ log("\t\t\t\t\t2D_MAX_WIDTH\t "+device.getInfo(cl.DEVICE_IMAGE2D_MAX_WIDTH)); | ||
{ | ||
var extensions=device_string.split(' '); | ||
var extensions=device_string.trim().split(' '); | ||
for(var i=0;i<extensions.length;i++) { | ||
@@ -233,3 +290,3 @@ if("nv_device_attribute_query"===extensions[i]) | ||
else | ||
log(" DEVICE_EXTENSIONS: None"); | ||
log("\t\t\t\t\tNone"); | ||
@@ -236,0 +293,0 @@ if(nv_device_attibute_query) |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../../webcl'); | ||
WebCL = require('../../webcl'); | ||
clu = require('../../lib/clUtils'); | ||
@@ -50,2 +50,3 @@ util = require('util'); | ||
// cl stuff | ||
var cl = new WebCL(); | ||
var /* cl_context */ ComputeContext; | ||
@@ -52,0 +53,0 @@ var /* cl_command_queue */ ComputeCommands; |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -45,2 +45,4 @@ util = require('util'); | ||
var cl = new WebCL(); | ||
//First check if the webcl extension is installed at all | ||
@@ -118,3 +120,3 @@ if (cl == undefined) { | ||
// Query the set of GPU devices on this platform | ||
cdDevices = cpPlatform.getDevices(cl.DEVICE_TYPE_GPU); | ||
cdDevices = cpPlatform.getDevices(cl.DEVICE_TYPE_DEFAULT); | ||
log(" # of Devices Available = " + cdDevices.length); | ||
@@ -121,0 +123,0 @@ var device = cdDevices[0]; |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -35,2 +35,4 @@ log=console.log; | ||
var cl = new WebCL(); | ||
//First check if the WebCL extension is installed at all | ||
@@ -61,3 +63,3 @@ if (cl == undefined) { | ||
//Query the set of devices on this platform | ||
devices = platform.getDevices(cl.DEVICE_TYPE_GPU); | ||
devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT); | ||
log('using device: '+devices[0].getInfo(cl.DEVICE_NAME)); | ||
@@ -67,3 +69,3 @@ | ||
context=cl.createContext({ | ||
deviceType: cl.DEVICE_TYPE_GPU, | ||
deviceType: cl.DEVICE_TYPE_DEFAULT, | ||
platform: platform | ||
@@ -121,12 +123,5 @@ }); | ||
// Do the work | ||
queue.enqueueWriteBuffer (aBuffer, false, { | ||
buffer: A, | ||
origin: [0], | ||
size: [A.length*Uint32Array.BYTES_PER_ELEMENT]}); | ||
queue.enqueueWriteBuffer (aBuffer, false, 0, A.length*Uint32Array.BYTES_PER_ELEMENT, A); | ||
queue.enqueueWriteBuffer (bBuffer, false, 0, B.length*Uint32Array.BYTES_PER_ELEMENT, B); | ||
queue.enqueueWriteBuffer (bBuffer, false, { | ||
buffer: B, | ||
origin: [0], | ||
size: [B.length*Uint32Array.BYTES_PER_ELEMENT]}); | ||
// Execute (enqueue) kernel | ||
@@ -141,7 +136,4 @@ log("using enqueueNDRangeKernel"); | ||
var C=new Uint32Array(BUFFER_SIZE); | ||
queue.enqueueReadBuffer (cBuffer, true, { | ||
buffer: C, | ||
origin: [0], | ||
size: [C.length*Uint32Array.BYTES_PER_ELEMENT]}); | ||
queue.enqueueReadBuffer (cBuffer, true, 0, C.length*Uint32Array.BYTES_PER_ELEMENT, C); | ||
// print results | ||
@@ -148,0 +140,0 @@ printResults(A,B,C); |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
clu = require('../lib/clUtils'); | ||
@@ -35,2 +35,4 @@ log=console.log; | ||
var cl = new WebCL(); | ||
//First check if the WebCL extension is installed at all | ||
@@ -62,3 +64,3 @@ if (cl == undefined) { | ||
//Query the set of devices on this platform | ||
devices = platform.getDevices(cl.DEVICE_TYPE_GPU); | ||
devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT); | ||
log('using device: '+devices[0].getInfo(cl.DEVICE_NAME)); | ||
@@ -68,3 +70,3 @@ | ||
context=cl.createContext({ | ||
deviceType: cl.DEVICE_TYPE_GPU, | ||
deviceType: cl.DEVICE_TYPE_DEFAULT, | ||
platform: platform | ||
@@ -71,0 +73,0 @@ }); |
{ | ||
"name":"node-webcl", | ||
"version":"0.5.0", | ||
"version":"0.6.0", | ||
"description":"A WebCL implementation for desktops with NodeJS", | ||
@@ -38,3 +38,3 @@ "main":"webcl.js", | ||
"scripts":{ | ||
"install":"node-waf configure clean build" | ||
"install":"node-gyp rebuild" | ||
}, | ||
@@ -41,0 +41,0 @@ "dependencies":{ |
@@ -27,15 +27,20 @@ Introduction | ||
------------ | ||
- [node-webgl][NODE_WEBGL] | ||
This module is used for samples using WebGL interoperability with WebCL. | ||
- [node-webgl][NODE_WEBGL]. This module is used for samples using WebGL interoperability with WebCL. | ||
In turns, [node-webgl][NODE_WEBGL] relies on [node-glfw][NODE_GLFW] that relies on [GLFW][GLFW], [GLEW][GLEW], [AntTweakBar][ANTTWEAKBAR]. See node-webgl and node-glfw for instructions on how to install these modules. | ||
- OpenCL 1.1 | ||
OpenCL 1.1 must be installed on your machine. Typically, this means your machine has a not too old graphic card (maybe not more than 3 years old) and its latest graphic drivers installed. | ||
- OpenCL 1.1 must be installed on your machine. Typically, this means your machine has a not too old graphic card (maybe not more than 3 years old) and its latest graphic drivers installed. | ||
On Mac, you must use OSX 10.7 "Lion" at minimum since OSX 10.6 "Snow Leopard" only supports OpenCL 1.0 and is buggy. | ||
On Mac, we recommend using OSX 10.7 "Lion" since OSX 10.6 "Snow Leopard" only supports OpenCL 1.0 and is buggy. | ||
On Windows, use Windows 7. | ||
On Windows, use Windows 7. Note that if your machine is 64-bit, you should use node.js 64-bit distribution, not the 32-bit default to avoid mismatch between node libraries and these native dependencies when node-gyp build the modules. | ||
On Linux, make sure you use the latest AMD or NVidia drivers. This module has been tested with Ubuntu 10.10, 11.04 and 11.10. | ||
On Linux, make sure you use the latest AMD or NVidia drivers. This module has been tested with Ubuntu 10.10, 11.04 and 11.10 64-bit. | ||
Pre-built binaries are available in submodule deps. Don't forget to do: | ||
git submodule init | ||
git submodule udpate | ||
if you need these binaries. | ||
Installation | ||
@@ -51,2 +56,8 @@ ------------ | ||
If you want to use the latest code, simply do | ||
node-gyp rebuild | ||
in node-webcl, node-webgl, and node-glfw. | ||
A crash course on WebCL | ||
@@ -53,0 +64,0 @@ ======================= |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
log = console.log; | ||
@@ -35,4 +35,8 @@ exit = process.exit; | ||
var cl = new WebCL(); | ||
var completed_kernel=false, completed_read=false; | ||
// kernel callback | ||
function kernel_complete(status, data) { | ||
function kernel_complete(event, data) { | ||
var status=event.status; | ||
log('in JS kernel_complete, status: '+status); | ||
@@ -42,6 +46,8 @@ if(status<0) | ||
log(data); | ||
completed_kernel=true; | ||
} | ||
// read buffer callback | ||
function read_complete(status, data) { | ||
function read_complete(event, data) { | ||
var status=event.status; | ||
log('in JS read_complete, status: '+status); | ||
@@ -65,5 +71,6 @@ if(status<0) | ||
log("The data has not been initialized successfully."); | ||
completed_read=true; | ||
} | ||
function main() { | ||
(function main() { | ||
/* CL objects */ | ||
@@ -98,2 +105,3 @@ var /* WebCLPlatform */ platform; | ||
log(data+" : "+err); | ||
exit(1); | ||
}); | ||
@@ -171,7 +179,3 @@ | ||
read_event=new cl.WebCLEvent(); | ||
queue.enqueueReadBuffer(data_buffer, false, { | ||
buffer: data, | ||
origin: [0], | ||
size: [4096*4] | ||
}, null, read_event); | ||
queue.enqueueReadBuffer(data_buffer, false, 0, 4096*4, data, null, read_event); | ||
} catch(ex) { | ||
@@ -192,7 +196,5 @@ log("Couldn't read the buffer. "+ex); | ||
queue.finish(); // wait for everything to finish | ||
//read_complete(read_event, cl.COMPLETE, data); | ||
log("main app thread END"); | ||
//exit(0); | ||
} | ||
main(); | ||
log("main app thread END"); | ||
})(); | ||
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
log = console.log; | ||
@@ -36,2 +36,3 @@ exit = process.exit; | ||
/* CL objects */ | ||
var cl = new WebCL(); | ||
var /* WebCLPlatform */ platform; | ||
@@ -48,3 +49,4 @@ var /* WebCLDevice */ device; | ||
// kernel callback | ||
function kernel_complete(status, data) { | ||
function kernel_complete(event, data) { | ||
var status=event.status; | ||
log('in JS kernel_complete, status: '+status); | ||
@@ -57,3 +59,4 @@ if(status<0) | ||
// read buffer callback | ||
function read_complete(status, data) { | ||
function read_complete(event, data) { | ||
var status=event.status; | ||
log('in JS read_complete, status: '+status); | ||
@@ -124,7 +127,3 @@ if(status<0) | ||
read_event=new cl.WebCLEvent(); | ||
queue.enqueueReadBuffer(data_buffer, false, { | ||
buffer: data, | ||
origin: [0], | ||
size: [4096*4] | ||
}, null, read_event); | ||
queue.enqueueReadBuffer(data_buffer, false, 0, 4096*4, data, null, read_event); | ||
} catch(ex) { | ||
@@ -131,0 +130,0 @@ log("Couldn't read the buffer. "+ex); |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
log = console.log; | ||
@@ -42,2 +42,3 @@ exit = process.exit; | ||
/* CL objects */ | ||
var cl = new WebCL(); | ||
var /* WebCLPlatform */ platform; | ||
@@ -76,3 +77,3 @@ var /* WebCLDevice */ device; | ||
//Query the set of devices on this platform | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU); | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT); | ||
device=devices[0]; | ||
@@ -79,0 +80,0 @@ log('using device: '+device.getInfo(cl.DEVICE_NAME)); |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
log = console.log; | ||
@@ -42,2 +42,3 @@ exit = process.exit; | ||
/* CL objects */ | ||
var cl = new WebCL(); | ||
var /* WebCLPlatform */ platform; | ||
@@ -69,3 +70,3 @@ var /* WebCLDevice */ device; | ||
//Query the set of devices on this platform | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_GPU); | ||
var devices = platform.getDevices(cl.DEVICE_TYPE_DEFAULT); | ||
device=devices[0]; | ||
@@ -159,6 +160,3 @@ log('using device: '+device.getInfo(cl.DEVICE_NAME)); | ||
try { | ||
queue.enqueueReadBuffer(data_buffer, true, { | ||
buffer: data, | ||
size: data.byteLength | ||
}, null, prof_event); | ||
queue.enqueueReadBuffer(data_buffer, true, 0, data.byteLength, data, null, prof_event); | ||
} catch(ex) { | ||
@@ -165,0 +163,0 @@ log("Couldn't read the buffer. "+ex); |
@@ -29,3 +29,3 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
if(nodejs) { | ||
cl = require('../webcl'); | ||
WebCL = require('../webcl'); | ||
log = console.log; | ||
@@ -42,2 +42,3 @@ exit = process.exit; | ||
/* CL objects */ | ||
var cl = new WebCL(); | ||
var /* WebCLPlatform */ platform; | ||
@@ -152,6 +153,3 @@ var /* WebCLDevice */ device; | ||
read_event=new cl.WebCLEvent(); | ||
queue.enqueueReadBuffer(data_buffer, false, { | ||
buffer: data, | ||
size: data.byteLength | ||
}, [ kernel_event ], read_event); | ||
queue.enqueueReadBuffer(data_buffer, false, 0, data.byteLength, data, [ kernel_event ], read_event); | ||
} catch(ex) { | ||
@@ -158,0 +156,0 @@ log("Couldn't read the buffer. "+ex); |
315
webcl.js
@@ -27,12 +27,18 @@ // Copyright (c) 2011-2012, Motorola Mobility, Inc. | ||
var cl = module.exports = require('./build/Release/webcl.node'); | ||
"use strict"; | ||
var cl = require('./build/Release/webcl.node'); | ||
module.exports = function WebCL() { | ||
return cl; | ||
}; | ||
cl.size = {}; | ||
cl.size.CHAR=cl.size_CHAR; | ||
cl.size.SHORT=cl.size_SHORT; | ||
cl.size.INT=cl.size_INT; | ||
cl.size.LONG=cl.size_LONG; | ||
cl.size.FLOAT=cl.size_FLOAT; | ||
cl.size.DOUBLE=cl.size_DOUBLE; | ||
cl.size.HALF=cl.size_HALF; | ||
cl.size.CHAR = cl.size_CHAR; | ||
cl.size.SHORT = cl.size_SHORT; | ||
cl.size.INT = cl.size_INT; | ||
cl.size.LONG = cl.size_LONG; | ||
cl.size.FLOAT = cl.size_FLOAT; | ||
cl.size.DOUBLE = cl.size_DOUBLE; | ||
cl.size.HALF = cl.size_HALF; | ||
@@ -54,7 +60,7 @@ cl.type = {}; | ||
cl.type.VEC2 = 1<<16; | ||
cl.type.VEC3 = 1<<17; | ||
cl.type.VEC4 = 1<<18; | ||
cl.type.VEC8 = 1<<19; | ||
cl.type.VEC16 = 1<<20; | ||
cl.type.VEC2 = 1 << 16; | ||
cl.type.VEC3 = 1 << 17; | ||
cl.type.VEC4 = 1 << 18; | ||
cl.type.VEC8 = 1 << 19; | ||
cl.type.VEC16 = 1 << 20; | ||
@@ -140,131 +146,198 @@ cl.type.LOCAL_MEMORY_SIZE = 0xFF; | ||
cl.WebCLCommandQueue.prototype.enqueueWriteBuffer=function (memory_object, blocking_write, region, event_list, event) { | ||
if (!(arguments.length >= 3 && | ||
checkObjectType(memory_object, 'WebCLBuffer') && | ||
(typeof blocking_write === 'boolean' || typeof blocking_write === 'number') && | ||
typeof region === 'object' && | ||
cl.WebCLCommandQueue.prototype.enqueueWriteBuffer=function (buffer, blocking_write, offset, cb, ptr, event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(buffer, 'WebCLBuffer') && | ||
(typeof blocking_write === 'boolean' || typeof blocking_write === 'number') && | ||
typeof offset === 'number' && typeof cb === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteBuffer(WebCLBuffer buffer, boolean blocking_write, ' + | ||
'uint offset, uint cb, ArrayBuffer ptr, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueWriteBuffer(buffer, blocking_write, offset, cb, ptr, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueReadBuffer=function (buffer, blocking_read, offset, cb, ptr, event_list, event) { | ||
//console.log('checking object: type: '+Object.prototype.toString.call(ptr)+' for typeof: '+typeof(ptr)); | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(buffer, 'WebCLBuffer') && | ||
(typeof blocking_read === 'boolean' || typeof blocking_read === 'number') && | ||
typeof offset === 'number' && typeof cb === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteBuffer(WebCLBuffer memory_object, boolean blocking_write, WebCLRegion region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueWriteBuffer(memory_object, blocking_write, region, event_list, event); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadBuffer(WebCLBuffer buffer, boolean blocking_read, ' + | ||
'uint offset, uint cb, ArrayBuffer ptr, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueReadBuffer(buffer, blocking_read, offset, cb, ptr, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueReadBuffer=function (memory_object, blocking_read, region, event_list, event) { | ||
if (!(arguments.length >= 3 && | ||
checkObjectType(memory_object, 'WebCLBuffer') && | ||
(typeof blocking_read === 'boolean' || typeof blocking_read === 'number') && | ||
typeof region === 'object' && | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBuffer=function (src_buffer, dst_buffer, | ||
src_offset, dst_offset, size, | ||
event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(src_buffer, 'WebCLBuffer') && | ||
checkObjectType(dst_buffer, 'WebCLBuffer') && | ||
typeof src_offset === 'number' && typeof dst_offset === 'number' && typeof size === 'number' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadBuffer(WebCLBuffer memory_object, boolean blocking_read, WebCLRegion region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBuffer(WebCLBuffer src_buffer, WebCLBuffer dst_buffer, ' + | ||
'int src_offset, int dst_offset, int size, ' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueReadBuffer(memory_object, blocking_read, region, event_list, event); | ||
return this._enqueueCopyBuffer(src_buffer, dst_buffer, | ||
src_offset, dst_offset, size, | ||
event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBuffer=function (memory_object_src, memory_object_dst, src_offset, dst_offset, size, event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(memory_object_src, 'WebCLBuffer') && | ||
checkObjectType(memory_object_dst, 'WebCLBuffer') && | ||
typeof src_offset === 'number' && | ||
typeof dst_offset === 'number' && | ||
cl.WebCLCommandQueue.prototype.enqueueWriteBufferRect=function (buffer, blocking_write, | ||
buffer_origin, host_origin, region, | ||
buffer_row_pitch, buffer_slice_pitch, | ||
host_row_pitch, host_slice_pitch, | ||
ptr, | ||
event_list, event) { | ||
if (!(arguments.length >= 9 && | ||
checkObjectType(buffer, 'WebCLBuffer') && | ||
(typeof blocking_write === 'boolean' || typeof blocking_write === 'number') && | ||
typeof buffer_origin === 'object' && typeof host_origin === 'object' && typeof region === 'object' && | ||
typeof host_row_pitch === 'number' && typeof host_slice_pitch === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBuffer(WebCLBuffer memory_object_src, WebCLBuffer memory_object_dst, int src_offset, int dst_offset, int size, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueCopyBuffer(memory_object_src, memory_object_dst, src_offset, dst_offset, size, event_list, event); | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteBufferRect(WebCLBuffer memory_object, ' + | ||
'boolean blocking_write, uint[3] buffer_origin, uint[3] host_origin, uint[3] region, ' + | ||
'uint buffer_row_pitch, uint buffer_slice_pitch, uint host_row_pitch, uint host_slice_pitch, ' + | ||
'ArrayBuffer ptr,' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueWriteBufferRect(buffer, blocking_write, | ||
buffer_origin, host_origin, region, | ||
buffer_row_pitch, buffer_slice_pitch, | ||
host_row_pitch, host_slice_pitch, | ||
ptr, | ||
event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueWriteBufferRect=function (memory_object, blocking_write, bufferRegion, hostRegion, event_list, event) { | ||
if (!(arguments.length >= 4 && | ||
checkObjectType(memory_object, 'WebCLBuffer') && | ||
(typeof blocking_write === 'boolean' || typeof blocking_write === 'number') && | ||
typeof bufferRegion === 'object' && typeof hostRegion === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteBufferRect(WebCLBuffer memory_object, boolean blocking_write, WebCLRegion bufferRegion, WebCLRegion hostRegion, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueWriteBufferRect(memory_object, blocking_write, | ||
bufferRegion, hostRegion, event_list, event); | ||
cl.WebCLCommandQueue.prototype.enqueueReadBufferRect=function (buffer, blocking_read, | ||
buffer_origin, host_origin, region, | ||
buffer_row_pitch, buffer_slice_pitch, | ||
host_row_pitch, host_slice_pitch, | ||
ptr, | ||
event_list, event) { | ||
if (!(arguments.length >= 9 && | ||
checkObjectType(buffer, 'WebCLBuffer') && | ||
(typeof blocking_read === 'boolean' || typeof blocking_read === 'number') && | ||
typeof buffer_origin === 'object' && typeof host_origin === 'object' && typeof region === 'object' && | ||
typeof host_row_pitch === 'number' && typeof host_slice_pitch === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadBufferRect(WebCLBuffer buffer, ' + | ||
'boolean blocking_write, uint[3] buffer_origin, uint[3] host_origin, uint[3] region, ' + | ||
'uint buffer_row_pitch, uint buffer_slice_pitch, uint host_row_pitch, uint host_slice_pitch, ' + | ||
'ArrayBuffer ptr,' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueReadBufferRect(buffer, blocking_read, | ||
buffer_origin, host_origin, region, | ||
buffer_row_pitch, buffer_slice_pitch, | ||
host_row_pitch, host_slice_pitch, | ||
ptr, | ||
event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueReadBufferRect=function (memory_object, blocking_write, bufferRegion, hostRegion, event_list, event) { | ||
if (!(arguments.length >= 4 && | ||
checkObjectType(memory_object, 'WebCLBuffer') && | ||
(typeof blocking_write === 'boolean' || typeof blocking_write === 'number') && | ||
typeof bufferRegion === 'object' && typeof hostRegion === 'object' && | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBufferRect=function (src_buffer, dst_buffer, | ||
src_origin, dst_origin, region, | ||
src_row_pitch, src_slice_pitch, | ||
dst_row_pitch, dst_slice_pitch, | ||
event_list, event) { | ||
if (!(arguments.length >= 9 && | ||
checkObjectType(src_buffer, 'WebCLBuffer') && checkObjectType(dst_buffer, 'WebCLBuffer') && | ||
typeof src_origin === 'object' && typeof dst_origin === 'object' && typeof region === 'object' && | ||
typeof src_row_pitch === 'number' && typeof src_slice_pitch === 'number' && | ||
typeof dst_row_pitch === 'number' && typeof dst_slice_pitch === 'number' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadBufferRect(WebCLBuffer memory_object, boolean blocking_write, WebCLRegion bufferRegion, WebCLRegion hostRegion, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBufferRect(WebCLBuffer src_buffer, WebCLBuffer dst_buffer, ' + | ||
'uint[3] src_origin, uint[3] dst_origin, uint[3] region, ' + | ||
'uint src_row_pitch, uint src_slice_pitch, ' + | ||
'uint dst_row_pitch, uint dst_slice_pitch, ' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueReadBufferRect(memory_object, blocking_write, bufferRegion, hostRegion, event_list, event); | ||
return this._enqueueCopyBufferRect(src_buffer, dst_buffer, | ||
src_origin, dst_origin, region, | ||
src_row_pitch, src_slice_pitch, | ||
dst_row_pitch, dst_slice_pitch, | ||
event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBufferRect=function (srcRegion, dstRegion, event_list, event) { | ||
if (!(arguments.length >= 2 && | ||
typeof srcRegion === 'object' && typeof dstRegion === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBufferRect(WebCLRegion srcRegion, WebCLRegion dstRegion, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueCopyBufferRect(srcRegion, dstRegion, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueWriteImage=function (memory_object, blocking_write, srcOrigin, region, row_pitch, slice_pitch, host_ptr, event_list, event) { | ||
if (!(arguments.length >= 7 && | ||
checkObjectType(memory_object, 'WebCLImage') && | ||
typeof srcOrigin === 'object' && | ||
cl.WebCLCommandQueue.prototype.enqueueWriteImage=function (image, blocking_write, origin, region, row_pitch, slice_pitch, ptr, event_list, event) { | ||
//console.log('checking object: type: '+Object.prototype.toString.call(ptr)+' for typeof: '+typeof(ptr)); | ||
if (!(arguments.length >= 7 && | ||
checkObjectType(image, 'WebCLImage') && | ||
typeof origin === 'object' && | ||
typeof region === 'object' && | ||
typeof row_pitch === 'number' && | ||
typeof slice_pitch === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteImage(WebCLImage memory_object, boolean blocking_write, int[3] origin, int[3] region, int row_pitch, int slice_pitch, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueWriteImage(WebCLImage image, boolean blocking_write, ' + | ||
'int[3] origin, int[3] region, int row_pitch, int slice_pitch, ArrayBuffer ptr, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueWriteImage(memory_object, blocking_write, srcOrigin, region, row_pitch, slice_pitch, host_ptr, event_list, event); | ||
return this._enqueueWriteImage(image, blocking_write, origin, region, row_pitch, slice_pitch, ptr, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueReadImage=function (memory_object, blocking_read, srcOrigin, regionArray, row_pitch, slice_pitch, host_ptr, event_list, event) { | ||
cl.WebCLCommandQueue.prototype.enqueueReadImage=function (image, blocking_read, origin, region, row_pitch, slice_pitch, | ||
ptr, event_list, event) { | ||
if (!(arguments.length >= 7 && | ||
checkObjectType(memory_object, 'WebCLImage') && | ||
typeof srcOrigin === 'object' && | ||
typeof regionArray === 'object' && | ||
checkObjectType(image, 'WebCLImage') && | ||
typeof origin === 'object' && | ||
typeof region === 'object' && | ||
typeof row_pitch === 'number' && | ||
typeof slice_pitch === 'number' && | ||
typeof ptr === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadImage(WebCLImage memory_object, boolean blocking_write, WebCLRegion region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueReadImage(WebCLImage image, boolean blocking_write, ' + | ||
'uint[3] region, uint row_pitch, uint slice_pitch, ' + | ||
'ArrayBuffer ptr, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueReadImage(memory_object, blocking_read, srcOrigin, regionArray, row_pitch, slice_pitch, host_ptr, event_list, event); | ||
return this._enqueueReadImage(image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueCopyImage=function (memory_object_src, memory_object_dst, srcOrigin, dstOrigin, regionArray, event_list, event) { | ||
cl.WebCLCommandQueue.prototype.enqueueCopyImage=function (src_image, dst_image, src_origin, dst_origin, region, | ||
event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(memory_object_src, 'WebCLImage') && | ||
checkObjectType(memory_object_dst, 'WebCLImage') && | ||
typeof srcOrigin === 'object' && | ||
typeof dstOrigin === 'object' && | ||
typeof regionArray === 'object' && | ||
checkObjectType(src_image, 'WebCLImage') && | ||
checkObjectType(dst_image, 'WebCLImage') && | ||
typeof src_origin === 'object' && | ||
typeof dst_origin === 'object' && | ||
typeof region === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyImage(WebCLImage memory_object_src, WebCLImage memory_object_dst, boolean blocking_write, WebCLRegion region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyImage(WebCLImage src_image, WebCLImage dst_image, ' + | ||
'uint[3] src_origin, uint[3] dst_origin, uint[3] region, ' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueCopyImage(memory_object_src, memory_object_dst, srcOrigin, dstOrigin, regionArray, event_list, event); | ||
return this._enqueueCopyImage(src_image, dst_image, src_origin, dst_origin, region, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueCopyImageToBuffer=function (memory_object_src, memory_object_dst, srcOrigin, regionArray, dst_offset, event_list, event) { | ||
cl.WebCLCommandQueue.prototype.enqueueCopyImageToBuffer=function (src_image, dst_buffer, src_origin, region, dst_offset, | ||
event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(memory_object_src, 'WebCLImage') && | ||
checkObjectType(memory_object_dst, 'WebCLBuffer') && | ||
typeof srcOrigin === 'object' && | ||
typeof regionArray === 'object' && | ||
checkObjectType(src_image, 'WebCLImage') && | ||
checkObjectType(dst_buffer, 'WebCLBuffer') && | ||
typeof src_origin === 'object' && | ||
typeof region === 'object' && | ||
typeof dst_offset === 'number' && | ||
@@ -274,20 +347,24 @@ (typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyImageToBuffer(WebCLImage memory_object_src, WebCLBuffer memory_object_dst, uint[3] srcOrigin, uint[3] region, uint dst_offset, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyImageToBuffer(WebCLImage src_image, WebCLBuffer dst_buffer, ' + | ||
'uint[3] src_origin, uint[3] region, uint dst_offset, ' + | ||
'WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueCopyImageToBuffer(memory_object_src, memory_object_dst, srcOrigin, regionArray, dst_offset, event_list, event); | ||
return this._enqueueCopyImageToBuffer(src_image, dst_buffer, src_origin, region, dst_offset, event_list, event); | ||
} | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBufferToImage=function (memory_object_src, memory_object_dst, srcOffset, dstOrigin, regionArray, event_list, event) { | ||
cl.WebCLCommandQueue.prototype.enqueueCopyBufferToImage=function (src_buffer, dst_image, src_offset, dst_origin, | ||
region, event_list, event) { | ||
if (!(arguments.length >= 5 && | ||
checkObjectType(memory_object_src, 'WebCLBuffer') && | ||
checkObjectType(memory_object_dst, 'WebCLImage') && | ||
typeof srcOffset === 'number' && | ||
typeof dstOrigin === 'object' && | ||
typeof regionArray === 'object' && | ||
checkObjectType(src_buffer, 'WebCLBuffer') && | ||
checkObjectType(dst_image, 'WebCLImage') && | ||
typeof src_offset === 'number' && | ||
typeof dst_origin === 'object' && | ||
typeof region === 'object' && | ||
(typeof event_list === 'undefined' || typeof event_list === 'object') && | ||
(typeof event === 'undefined' || checkObjectType(event, 'WebCLEvent')) | ||
)) { | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBufferToImage(WebCLBuffer memory_object_src, WebCLImage memory_object_dst, uint srcOffset, uint[3] dstOrigin, uint[4] region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
throw new TypeError('Expected WebCLCommandQueue.enqueueCopyBufferToImage(WebCLBuffer src_buffer, WebCLImage dst_image, ' + | ||
'uint src_offset, uint[3] dst_origin, uint[4] region, WebCLEvent[] event_list, WebCLEvent event)'); | ||
} | ||
return this._enqueueCopyBufferToImage(memory_object_src, memory_object_dst, srcOffset, dstOrigin, regionArray, event_list, event); | ||
return this._enqueueCopyBufferToImage(src_buffer, dst_image, src_offset, dst_origin, region, event_list, event); | ||
} | ||
@@ -443,20 +520,12 @@ | ||
cl.WebCLContext.prototype.createImage2D=function (flags, image_format, width, height, row_pitch, host_ptr) { | ||
if (!(arguments.length >= 5 && typeof flags === 'number' && typeof image_format === 'object' && | ||
typeof width === 'number' && typeof height === 'number' && typeof row_pitch === 'number' && | ||
(typeof host_ptr === 'undefined' || typeof host_ptr === 'object'))) { | ||
throw new TypeError('Expected WebCLContext.createImage2D(CLenum flags, cl.WebCLImageFormat format, int width, int height, int row_pitch, optional ArrayBuffer host_ptr)'); | ||
cl.WebCLContext.prototype.createImage=function (flags, descriptor, host_ptr) { | ||
if (!(arguments.length === 3 && typeof flags === 'number' && | ||
typeof descriptor === 'object' && | ||
typeof host_ptr === 'object')) { | ||
throw new TypeError('Expected WebCLContext.createImage3D(CLenum flags, cl.WebCLImageDescriptor descriptor, ' + | ||
'ArrayBuffer host_ptr)'); | ||
} | ||
return this._createImage2D(flags, image_format, width, height, row_pitch, host_ptr); | ||
return this._createImage(flags, descriptor, host_ptr); | ||
} | ||
cl.WebCLContext.prototype.createImage3D=function (flags, image_format, width, height, row_pitch, host_ptr) { | ||
if (!(arguments.length === 8 && typeof flags === 'number' && typeof image_format === 'number' && | ||
typeof width === 'number' && typeof height === 'number' && typeof depth === 'number' && | ||
typeof row_pitch === 'number' && typeof slice_pitch === 'number' && typeof host_ptr === 'object')) { | ||
throw new TypeError('Expected WebCLContext.createImage3D(CLenum flags, cl.WebCLImageFormat format, int width, int height, int depth, int row_pitch, int slice_pitch, ArrayBuffer host_ptr)'); | ||
} | ||
return this._createImage3D(flags, image_format, width, height, depth, row_pitch, slice_pitch, host_ptr); | ||
} | ||
cl.WebCLContext.prototype.createSampler=function (normalized_coords, addressing_mode, filter_mode) { | ||
@@ -493,2 +562,9 @@ if (!(arguments.length === 3 && | ||
cl.WebCLContext.prototype.createFromGLRenderbuffer=function (flags, buffer) { | ||
if (!(arguments.length === 2 && typeof flags === 'number' && typeof buffer ==='object')) { | ||
throw new TypeError('Expected WebCLContext.createFromGLRenderbuffer(CLenum flags, WebGLRenderbuffer buffer)'); | ||
} | ||
return this._createFromGLRenderbuffer(flags, buffer ? buffer._ : 0); | ||
} | ||
cl.WebCLContext.prototype.createFromGLTexture2D=function (flags, texture_target, miplevel, texture) { | ||
@@ -678,3 +754,2 @@ if (!(arguments.length === 4 && typeof flags === 'number' && | ||
// TODO add callback | ||
cl.WebCLProgram.prototype.build=function (devices, options, data, callback) { | ||
@@ -681,0 +756,0 @@ if ( !(arguments.length === 1 && typeof devices === 'object') && |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 31 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 11 instances in 1 package
16243643
167
6532
125
9
33