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
fix: toString handling, greatly simplified
fix: Upgrade tests for toString
fix: Add boolean to typeings
fix: Move gl-kernel.js to new location
feat: Add strictIntegers as option for Kernel and docs
NOTE: documentation is slightly out of date for the upcoming release of v2. We will fix it! In the mean time, if you'd like to assist (PLEASE) let us know.
@@ -145,7 +145,7 @@ Settings are an object used to create an instance of `GPU`. Example: `new GPU(s
145
145
* 'webgl2': Use the `WebGL2Kernel` for transpiling a kernel
146
146
* 'headlessgl' **New in V2!**: Use the `HeadlessGLKernel` for transpiling a kernel
147
147
* 'cpu': Use the `CPUKernel` for transpiling a kernel
148
-
148
+
149
149
## `gpu.createKernel` Settings
150
150
Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.createKernel(settings)`
151
151
*`output`: array or object that describes the output of kernel.
@@ -173,6 +173,7 @@ Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.
173
173
* VERY IMPORTANT! - Use this to add special native functions to your environment when you need specific functionality is needed.
174
174
*`subKernels`: array, generally inherited from `GPU` instance.
175
175
*`immutable`: boolean, default = `false`
176
+
*`strictIntegers`: boolean, default = `false` - allows undefined argumentTypes and function return values to use strict integer declarations.
176
177
177
178
178
179
@@ -310,7 +311,7 @@ Debugging can be done in a variety of ways, and there are different levels of de
310
311
}, { output: [100, 100] });
311
312
```
312
313
* Debugging actual kernels on CPUwith`debugger`:
313
-
* This will cause "breakpoint" like behaviour, but in an actual CPUkernel. You'll peer into the compiled kernel here, for a CPU.
314
+
* This will cause "breakpoint" like behaviour, but in an actual CPUkernel. You'll peer into the compiled kernel here, for a CPU.
314
315
* Example:
315
316
```js
316
317
const gpu = new GPU({ mode: 'cpu' });
@@ -366,7 +367,7 @@ Debugging can be done in a variety of ways, and there are different levels of de
366
367
* Example:
367
368
```js
368
369
const { input } = require('gpu.js');
369
-
const value = input(flattenedArray, [width, height, depth]);
370
+
const value = input(flattenedArray, [width, height, depth]);
370
371
```
371
372
* HTML Image
372
373
* Array of HTML Images
@@ -467,7 +468,7 @@ Note: To animate the rendering, use `requestAnimationFrame` instead of `setTimeo
467
468
To make it easier to get pixels from a context, use `kernel.getPixels()`, which returns a flat array similar to what you get from WebGL's `readPixels` method.
468
469
A note on why: webgl's `readPixels` returns an array ordered differently from javascript's `getImageData`.
469
470
This makes them behave similarly.
470
-
While the values may be somewhat different, because of graphical precision available in the kernel, and alpha, this allows us to easily get pixel data in unified way.
471
+
While the values may be somewhat different, because of graphical precision available in the kernel, and alpha, this allows us to easily get pixel data in unified way.
471
472
472
473
Example:
473
474
```js
@@ -581,7 +582,7 @@ const kernel = gpu.createKernel(function(a, b) {
581
582
To manually strongly type a function you may use settings.
582
583
By setting this value, it makes the build step of the kernel less resource intensive.
583
584
Settings take an optional hash values:
584
-
* `returnType`: optional, defaults to inference from `FunctionBuilder`, the value you'd like to return from the function.
585
+
* `returnType`: optional, defaults to inference from `FunctionBuilder`, the value you'd like to return from the function.
585
586
* `argumentTypes`: optional, defaults to inference from `FunctionBuilder` for each param, a hash of param names with values of the return types.
586
587
587
588
Example:
@@ -787,7 +788,7 @@ This is a list of the supported ones:
787
788
We then seed the subsequent randoms from the previous random value.
788
789
So we seed from CPU, and generate from GPU.
789
790
Which is still not as good as CPU, but closer.
790
-
While this isn't perfect, it should suffice in most scenarios.
791
+
While this isn't perfect, it should suffice in most scenarios.
0 commit comments