You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -91,17 +91,17 @@ In JavaScript, initialize the library:
91
91
constgpu=newGPU();
92
92
```
93
93
94
-
## `GPU`Options
95
-
Options are an object used to create an instance of `GPU`. Example: `new GPU(options)`
94
+
## `GPU`Settings
95
+
Settings are an object used to create an instance of `GPU`. Example: `new GPU(settings)`
96
96
*`canvas`: `HTMLCanvasElement`. Optional. For sharing canvas. Example: use THREE.js and GPU.js on same canvas.
97
97
*`webGl`: `WebGL2RenderingContext` or `WebGLRenderingContext`. For sharing rendering context. Example: use THREE.js and GPU.js on same rendering context.
98
98
99
-
## `gpu.createKernel`Options
100
-
Options are an object used to create a `kernel` or `kernelMap`. Example: `gpu.createKernel(options)`
99
+
## `gpu.createKernel`Settings
100
+
Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.createKernel(settings)`
101
101
*`output`: array or object that describes the output of kernel.
102
102
* as array: `[width]`, `[width, height]`, or `[width, height, depth]`
103
103
* as object: `{ x: width, y: height, z: depth }`
104
-
*outputToTexture: boolean
104
+
*pipeline: boolean
105
105
* graphical: boolean
106
106
* loopMaxIterations: number
107
107
* constants: object
@@ -110,12 +110,12 @@ Options are an object used to create a `kernel` or `kernelMap`. Example: `gpu.c
110
110
* floatTextures: boolean - input/working textures use float32 for each colour channel
111
111
* floatOutput: boolean - output texture uses float32 for each colour channel
112
112
* fixIntegerDivisionAccuracy: boolean - some cards have accuracy issues dividing by factors of three and some other primes (most apple kit?). Default on for affected cards, disable if accuracy not required.
113
-
* functions: array or boolean
113
+
* functions: array or object
114
114
* nativeFunctions: object
115
115
* subKernels: array
116
-
*outputImmutable: boolean
116
+
*immutable: boolean
117
117
* default to `false`
118
-
118
+
119
119
120
120
121
121
## Creating and Running Functions
@@ -157,13 +157,13 @@ myFunc();
157
157
// Result: [0, 1, 2, 3, ... 99]
158
158
```
159
159
160
-
Note: Instead of creating an object, you can use the chainable shortcut methods as a neater way of specifying options.
160
+
Note: Instead of creating an object, you can use the chainable shortcut methods as a neater way of specifying settings.
161
161
162
162
```js
163
163
constmyFunc=gpu.createKernel(function() {
164
164
returnthis.thread.x;
165
165
}).setOutput([100]);
166
-
166
+
167
167
myFunc();
168
168
// Result: [0, 1, 2, 3, ... 99]
169
169
```
@@ -186,7 +186,7 @@ Numbers example:
186
186
```
187
187
188
188
Array(2) examples:
189
-
Using declaration
189
+
Using declaration
190
190
```js
191
191
constmyFunc=gpu.createKernel(function() {
192
192
constarray2= [0.08, 2];
@@ -202,7 +202,7 @@ Directly returned
202
202
```
203
203
204
204
Array(3) example:
205
-
Using declaration
205
+
Using declaration
206
206
```js
207
207
constmyFunc=gpu.createKernel(function() {
208
208
constarray2= [0.08, 2, 0.1];
@@ -218,7 +218,7 @@ Directly returned
218
218
```
219
219
220
220
Array(4) example:
221
-
Using declaration
221
+
Using declaration
222
222
```js
223
223
constmyFunc=gpu.createKernel(function() {
224
224
constarray2= [0.08, 2, 0.1, 3];
@@ -248,7 +248,7 @@ To define an argument, simply add it to the kernel function like regular JavaScr
This gives you the flexibility of using parts of a single transformation without the performance penalty, resulting in much much _MUCH_ faster operation.
413
413
414
414
## Adding custom functions
415
-
use `gpu.addFunction(function() {}, options)` for adding custom functions. Example:
415
+
use `gpu.addFunction(function() {}, settings)` for adding custom functions. Example:
416
416
417
417
418
418
```js
@@ -430,11 +430,11 @@ const kernel = gpu.createKernel(function(a, b) {
430
430
431
431
### Adding strongly typed functions
432
432
433
-
To strongly type a function you may use options. Options take an optional hash values:
433
+
To strongly type a function you may use settings. Settings take an optional hash values:
434
434
`returnType`: optional, defaults to float, the value you'd like to return from the function
435
-
`paramTypes`: optional, defaults to float for each param, a hash of param names with values of the return types
435
+
`argumentTypes`: optional, defaults to float for each param, a hash of param names with values of the return types
436
436
437
-
Types: that may be used for `returnType` or for each property of `paramTypes`:
437
+
Types: that may be used for `returnType` or for each property of `argumentTypes`:
@@ -497,7 +497,7 @@ const matMult = gpu.createKernel(function(a, b) {
497
497
498
498
## Pipelining
499
499
[Pipeline](https://en.wikipedia.org/wiki/Pipeline_(computing)) is a feature where values are sent directly from kernel to kernel via a texture.
500
-
This results in extremely fast computing. This is achieved with the kernel option `outputToTexture: boolean` option or by calling `kernel.setOutputToTexture(true)`
500
+
This results in extremely fast computing. This is achieved with the kernel option `pipeline: boolean` option or by calling `kernel.pipeline(true)`
501
501
502
502
## Offscreen Canvas
503
503
GPU.js supports offscreen canvas where available. Here is an example of how to use it with two files, `gpu-worker.js`, and `index.js`:
0 commit comments