Skip to content

Commit

Permalink
fix: #572 excessive calls, reuse textures
Browse files Browse the repository at this point in the history
feat: introduce WebGL._replaceOutputTexture and WebGL._replaceSubOutputTextures to cut down on resource usage
feat: All supportable Math.methods added
fix: Safari not able to render texture arguments
feat: CPU gets a pipeline that acts like GPU with/without immutable
  • Loading branch information
robertleeplummerjr committed Mar 22, 2020
1 parent fdedd6f commit 61dfe8a
Show file tree
Hide file tree
Showing 29 changed files with 1,840 additions and 353 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,10 @@ const matMult = gpu.createKernel(function(a, b) {
## Pipelining
[Pipeline](https://en.wikipedia.org/wiki/Pipeline_(computing)) is a feature where values are sent directly from kernel to kernel via a texture.
This results in extremely fast computing. This is achieved with the kernel setting `pipeline: boolean` or by calling `kernel.setPipeline(true)`
In an effort to make the CPU and GPU work similarly, pipeline on CPU and GPU modes causes the kernel result to be reused when `immutable: false` (which is default).
If you'd like to keep kernel results around, use `immutable: true` and ensure you cleanup memory:
* In gpu mode using `texture.delete()` when appropriate.
* In cpu mode allowing values to go out of context

### Cloning Textures **New in V2!**
When using pipeline mode the outputs from kernels can be cloned using `texture.clone()`.
Expand Down Expand Up @@ -1006,14 +1010,24 @@ This is a list of the supported ones:

* `Math.abs()`
* `Math.acos()`
* `Math.acosh()`
* `Math.asin()`
* `Math.asinh()`
* `Math.atan()`
* `Math.atanh()`
* `Math.atan2()`
* `Math.cbrt()`
* `Math.ceil()`
* `Math.cos()`
* `Math.cosh()`
* `Math.exp()`
* `Math.expm1()`
* `Math.floor()`
* `Math.fround()`
* `Math.imul()`
* `Math.log()`
* `Math.log10()`
* `Math.log1p()`
* `Math.log2()`
* `Math.max()`
* `Math.min()`
Expand All @@ -1030,8 +1044,15 @@ This is a list of the supported ones:
* `Math.round()`
* `Math.sign()`
* `Math.sin()`
* `Math.sinh()`
* `Math.sqrt()`
* `Math.tan()`
* `Math.tanh()`
* `Math.trunc()`

This is a list and reasons of unsupported ones:
* `Math.clz32` - bits directly are hard
* `Math.hypot` - dynamically sized

## How to check what is supported

Expand Down
Loading

0 comments on commit 61dfe8a

Please sign in to comment.