Skip to content

Commit aca2741

Browse files
feat: Added dynamicOutput && dynamicArguments as official settings
fix: Some documentation was out of date with the new features, so fixed
1 parent e3aded4 commit aca2741

25 files changed

+2903
-1448
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ Settings are an object used to create an instance of `GPU`. Example: `new GPU(s
148148

149149
## `gpu.createKernel` Settings
150150
Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.createKernel(settings)`
151-
* `output`: array or object that describes the output of kernel.
151+
* `output` or `kernel.setOutput(output)`: `array` or `object` that describes the output of kernel. When using `kernel.setOutput()` you _can_ call it after the kernel has compiled if `kernel.dynamicOutput` is `true`, to resize your output. Example:
152152
* as array: `[width]`, `[width, height]`, or `[width, height, depth]`
153153
* as object: `{ x: width, y: height, z: depth }`
154-
* `pipeline` **New in V2!**: boolean, default = `false`
154+
* `pipeline` or `kernel.setPipeline(true)` **New in V2!**: boolean, default = `false`
155155
* Causes `kernel()` calls to output a `Texture`. To get array's from a `Texture`, use:
156156
```js
157157
const result = kernel();
@@ -161,19 +161,20 @@ Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.
161161
```js
162162
kernel(texture);
163163
```
164-
* `graphical`: boolean, default = `false`
165-
* `loopMaxIterations`: number, default = 1000
166-
* `constants`: object, default = null
167-
* `hardcodeConstants`: boolean, default = false
168-
* `optimizeFloatMemory` **New in V2!**: boolean - causes a float32 texture to use all 4 channels rather than 1, using less memory, but consuming more GPU.
169-
* `precision` **New in V2!**: 'single' or 'unsigned' - if 'single' output texture uses float32 for each colour channel rather than 8
170-
* `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.
171-
* `functions`: array, array of functions to be used inside kernel. If undefined, inherits from `GPU` instance.
172-
* `nativeFunctions`: object, defined as: `{ functionName: functionSource }`
164+
* `graphical` or `kernel.setGraphical(boolean)`: boolean, default = `false`
165+
* `loopMaxIterations` or `kernel.setLoopMaxIterations(number)`: number, default = 1000
166+
* `constants` or `kernel.setConstants(object)`: object, default = null
167+
* `dynamicOutput` or `kernel.setDynamicOutput(boolean)`: boolean, default = false - turns dynamic output on or off
168+
* `dynamicArguments` or `kernel.setDynamicArguments(boolean)`: boolean, default = false - turns dynamic arguments (use different size arrays and textures) on or off
169+
* `optimizeFloatMemory` or `kernel.setOptimizeFloatMemory(boolean)` **New in V2!**: boolean - causes a float32 texture to use all 4 channels rather than 1, using less memory, but consuming more GPU.
170+
* `precision` or `kernel.setPrecision('unsigned' | 'single')` **New in V2!**: 'single' or 'unsigned' - if 'single' output texture uses float32 for each colour channel rather than 8
171+
* `fixIntegerDivisionAccuracy` or `kernel.setFixIntegerDivisionAccuracy(boolean)` : 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.
172+
* `functions` or `kernel.setFunctions(object)`: array, array of functions to be used inside kernel. If undefined, inherits from `GPU` instance.
173+
* `nativeFunctions` or `kernel.setNativeFunctions(object)`: object, defined as: `{ functionName: functionSource }`
173174
* VERY IMPORTANT! - Use this to add special native functions to your environment when you need specific functionality is needed.
174-
* `subKernels`: array, generally inherited from `GPU` instance.
175-
* `immutable`: boolean, default = `false`
176-
* `strictIntegers`: boolean, default = `false` - allows undefined argumentTypes and function return values to use strict integer declarations.
175+
* `subKernels` or `kernel.setSubKernels(array)`: array, generally inherited from `GPU` instance.
176+
* `immutable` or `kernel.setImmutable(boolean)`: boolean, default = `false`
177+
* `strictIntegers` or `kernel.setStrictIntegers(boolean)`: boolean, default = `false` - allows undefined argumentTypes and function return values to use strict integer declarations.
177178

178179

179180

bin/gpu-browser-core.js

Lines changed: 386 additions & 275 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)