Skip to content

Commit 26479a1

Browse files
fix documentation
1 parent 8a88552 commit 26479a1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ Sometimes you want to do multiple math operations on the gpu without the round t
225225
_**Note:**_ Kernels can have different output sizes.
226226
```js
227227
const add = gpu.createKernel(function(a, b) {
228-
return a[this.thread.x] + b[this.thread.x];
228+
return a + b;
229229
}).setOutput([20]);
230230

231231
const multiply = gpu.createKernel(function(a, b) {
232-
return a[this.thread.x] * b[this.thread.x];
232+
return a * b;
233233
}).setOutput([20]);
234234

235235
const superKernel = gpu.combineKernels(add, multiply, function(a, b, c) {
236-
return multiply(add(a, b), c);
236+
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
237237
});
238238

239239
superKernel(a, b, c);
@@ -248,13 +248,13 @@ Sometimes you want to do multiple math operations in one kernel, and save the ou
248248
```js
249249
const megaKernel = gpu.createKernelMap({
250250
addResult: function add(a, b) {
251-
return a[this.thread.x] + b[this.thread.x];
251+
return a + b;
252252
},
253253
multiplyResult: function multiply(a, b) {
254-
return a[this.thread.x] * b[this.thread.x];
254+
return a * b;
255255
},
256256
}, function(a, b, c) {
257-
return multiply(add(a, b), c);
257+
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
258258
});
259259

260260
megaKernel(a, b, c);
@@ -264,13 +264,13 @@ megaKernel(a, b, c);
264264
```js
265265
const megaKernel = gpu.createKernelMap([
266266
function add(a, b) {
267-
return a[this.thread.x] + b[this.thread.x];
267+
return a + b;
268268
},
269269
function multiply(a, b) {
270-
return a[this.thread.x] * b[this.thread.x];
270+
return a * b;
271271
}
272272
], function(a, b, c) {
273-
return multiply(add(a, b), c);
273+
return multiply(add(a[this.thread.x], b[this.thread.x]), c[this.thread.x]);
274274
});
275275

276276
megaKernel(a, b, c);

0 commit comments

Comments
 (0)