Initialises the GPU.js library class which manages the WebGL context for the created functions.
| GPU | Initialises the GPU.js library class which manages the WebGL context for the created functions. |
| Functions | |
| createKernel | This creates a callable function object to call the kernel function with the argument parameter set |
| getKernelFunction | Get and returns the kernel function previously set by `createKernel` |
| getKernelParamObj | Get and returns the kernel parameter object previously set by `createKernel` |
| executeKernel | Executes the kernel previously set by setKernel |
| addFunction | Adds additional functions, that the kernel may call. |
| getWebgl | [DEPRECATED] Returns the internal gpu webgl instance only if it has been initiated |
| getCanvas | [DEPRECATED] Returns the internal canvas instance only if it has been initiated |
| supportWebgl | Return TRUE, if browser supports webgl AND canvas |
function createKernel( kernel, paramObj )
This creates a callable function object to call the kernel function with the argument parameter set
The parameter object contains the following sub parameters
---------------|---------------|---------------------------------------------------------------------------|
Name | Default value | Description |
---------------|---------------|---------------------------------------------------------------------------|
dimensions | [1024] | Thread dimension array |
mode | null | CPU / GPU configuration mode, "auto" / null. Has the following modes. |
| | + null / "auto" : Attempts to build GPU mode, else fallbacks |
| | + "gpu" : Attempts to build GPU mode, else fallbacks |
| | + "cpu" : Forces JS fallback mode only |
---------------|---------------|---------------------------------------------------------------------------|inputFunction {JS Function} The calling to perform the conversion paramObj {Object} The parameter configuration object (see above)
callable function to run
function addFunction( jsFunction, paramTypeArray, returnType )
Adds additional functions, that the kernel may call.
| jsFunction | {JS Function} JS Function to do conversion |
| paramTypeArray | {[String,...]} Parameter type array, assumes all parameters are “float” if null |
| returnType | {String} The return type, assumes “float” if null |
{GPU} returns itself
This creates a callable function object to call the kernel function with the argument parameter set
function createKernel( kernel, paramObj )
Get and returns the kernel function previously set by `createKernel`
function getKernelFunction()
Get and returns the kernel parameter object previously set by `createKernel`
function getKernelParamObj()
Adds additional functions, that the kernel may call.
function addFunction( jsFunction, paramTypeArray, returnType )
[DEPRECATED] Returns the internal gpu webgl instance only if it has been initiated
function getWebgl()
[DEPRECATED] Returns the internal canvas instance only if it has been initiated
function getCanvas( mode )
Return TRUE, if browser supports webgl AND canvas
function supportWebgl()