Skip to content

Commit

Permalink
fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robertleeplummerjr authored Feb 27, 2018
1 parent 8a88552 commit 26479a1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ Sometimes you want to do multiple math operations on the gpu without the round t
_**Note:**_ Kernels can have different output sizes.
```js
const add = gpu.createKernel(function(a, b) {
return a[this.thread.x] + b[this.thread.x];
return a + b;
}).setOutput([20]);
const multiply = gpu.createKernel(function(a, b) {
return a[this.thread.x] * b[this.thread.x];
return a * b;
}).setOutput([20]);
const superKernel = gpu.combineKernels(add, multiply, function(a, b, c) {
return multiply(add(a, b), c);
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
});
superKernel(a, b, c);
Expand All @@ -248,13 +248,13 @@ Sometimes you want to do multiple math operations in one kernel, and save the ou
```js
const megaKernel = gpu.createKernelMap({
addResult: function add(a, b) {
return a[this.thread.x] + b[this.thread.x];
return a + b;
},
multiplyResult: function multiply(a, b) {
return a[this.thread.x] * b[this.thread.x];
return a * b;
},
}, function(a, b, c) {
return multiply(add(a, b), c);
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
});
megaKernel(a, b, c);
Expand All @@ -264,13 +264,13 @@ megaKernel(a, b, c);
```js
const megaKernel = gpu.createKernelMap([
function add(a, b) {
return a[this.thread.x] + b[this.thread.x];
return a + b;
},
function multiply(a, b) {
return a[this.thread.x] * b[this.thread.x];
return a * b;
}
], function(a, b, c) {
return multiply(add(a, b), c);
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
});
megaKernel(a, b, c);
Expand Down

0 comments on commit 26479a1

Please sign in to comment.