GPU

Initialises the GPU.js library class which manages the WebGL context for the created functions.

Summary
GPUInitialises the GPU.js library class which manages the WebGL context for the created functions.
Functions
createKernelThis creates a callable function object to call the kernel function with the argument parameter set
getKernelFunctionGet and returns the kernel function previously set by `createKernel`
getKernelParamObjGet and returns the kernel parameter object previously set by `createKernel`
executeKernelExecutes the kernel previously set by setKernel
addFunctionAdds 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
supportWebglReturn TRUE, if browser supports webgl AND canvas

Functions

createKernel

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                                |
---------------|---------------|---------------------------------------------------------------------------|

Parameters

inputFunction {JS Function} The calling to perform the conversion paramObj {Object} The parameter configuration object (see above)

Returns

callable function to run

getKernelFunction

function getKernelFunction()

Get and returns the kernel function previously set by `createKernel`

Returns

{JS Function} The calling input function

getKernelParamObj

function getKernelParamObj()

Get and returns the kernel parameter object previously set by `createKernel`

Returns

{JS Function} The calling input function

executeKernel

Executes the kernel previously set by setKernel

Parameters

.....  {Arguments} Various argument arrays used by the kernel

Returns

{Promise} returns the promise object for the result / failure

addFunction

function addFunction(jsFunction,
paramTypeArray,
returnType)

Adds additional functions, that the kernel may call.

Parameters

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

Retuns

{GPU} returns itself

getWebgl

function getWebgl()

[DEPRECATED] Returns the internal gpu webgl instance only if it has been initiated

Retuns

{WebGL object} that the instance use

getCanvas

function getCanvas(mode)

[DEPRECATED] Returns the internal canvas instance only if it has been initiated

Retuns

{Canvas object} that the instance use

supportWebgl

function supportWebgl()

Return TRUE, if browser supports webgl AND canvas

Note: This function can also be called directly `GPU.supportWebgl()`

Returns

{Boolean} TRUE if browser supports webgl

function createKernel(kernel,
paramObj)
This creates a callable function object to call the kernel function with the argument parameter set
function getKernelFunction()
Get and returns the kernel function previously set by `createKernel`
function getKernelParamObj()
Get and returns the kernel parameter object previously set by `createKernel`
function addFunction(jsFunction,
paramTypeArray,
returnType)
Adds additional functions, that the kernel may call.
function getWebgl()
[DEPRECATED] Returns the internal gpu webgl instance only if it has been initiated
function getCanvas(mode)
[DEPRECATED] Returns the internal canvas instance only if it has been initiated
function supportWebgl()
Return TRUE, if browser supports webgl AND canvas
Close