Skip to content

Commit 82e4966

Browse files
feat: v2.0.0rc1
Cleanup and add random support (seeded by... Math.random()!) I went through api and cleaned it up considerably
1 parent abdb7a6 commit 82e4966

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3510
-4642
lines changed

.babelrc

-3
This file was deleted.

.gitattributes

-6
This file was deleted.

.gitignore

-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Built files
2-
doc/*
3-
41
# Logs
52
logs
63
*.log
@@ -17,15 +14,9 @@ lib-cov
1714
# Coverage directory used by tools like istanbul
1815
coverage
1916

20-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21-
.grunt
22-
2317
# node-waf configuration
2418
.lock-wscript
2519

26-
# Compiled binary addons (http://nodejs.org/api/addons.html)
27-
build/Release
28-
2920
# Dependency directory
3021
node_modules
3122

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2018 gpu.js Team
3+
Copyright (c) 2019 gpu.js Team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.
101101
* `output`: array or object that describes the output of kernel.
102102
* as array: `[width]`, `[width, height]`, or `[width, height, depth]`
103103
* as object: `{ x: width, y: height, z: depth }`
104-
* outputToTexture: boolean
104+
* pipeline: boolean
105105
* graphical: boolean
106106
* loopMaxIterations: number
107107
* constants: object
@@ -113,7 +113,7 @@ Settings are an object used to create a `kernel` or `kernelMap`. Example: `gpu.
113113
* functions: array or object
114114
* nativeFunctions: object
115115
* subKernels: array
116-
* outputImmutable: boolean
116+
* immutable: boolean
117117
* default to `false`
118118

119119

@@ -497,7 +497,7 @@ const matMult = gpu.createKernel(function(a, b) {
497497

498498
## Pipelining
499499
[Pipeline](https://en.wikipedia.org/wiki/Pipeline_(computing)) is a feature where values are sent directly from kernel to kernel via a texture.
500-
This results in extremely fast computing. This is achieved with the kernel option `outputToTexture: boolean` option or by calling `kernel.setOutputToTexture(true)`
500+
This results in extremely fast computing. This is achieved with the kernel option `pipeline: boolean` option or by calling `kernel.pipeline(true)`
501501

502502
## Offscreen Canvas
503503
GPU.js supports offscreen canvas where available. Here is an example of how to use it with two files, `gpu-worker.js`, and `index.js`:

examples/simple-javascript.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ const { GPU } = require('../src');
22

33
const gpu = new GPU({ mode: 'gpu' });
44

5-
// Look ma! I can typescript on my GPU!
5+
// Look ma! I can javascript on my GPU!
66
function kernelFunction(anInt, anArray, aNestedArray) {
77
const x = .25 + anInt + anArray[this.thread.x] + aNestedArray[this.thread.x][this.thread.y];
88
return x;
9-
};
9+
}
1010

1111
const kernel = gpu.createKernel(kernelFunction, {
1212
output: [1]
1313
});
1414

15-
const result = kernel(1.25, [.25], [[1.25]]);
15+
const result = kernel(1, [.25], [[1.5]]);
1616

1717
console.log(result[0]); // 3

examples/simple-typescript.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {GPU} from "../src";
2-
import {KernelFunction, IKernel} from "../index";
1+
import {GPU, KernelFunction, IKernelRunShortcut} from "../src";
32

43
const gpu = new GPU({ mode: 'gpu' });
54

@@ -13,6 +12,6 @@ const kernel: IKernel = gpu.createKernel(kernelFunction, {
1312
output: [1]
1413
});
1514

16-
const result = kernel(1.25, [.25], [[1.25]]);
15+
const result = kernel(4, [5], [[6]], [[[7]]]);
1716

18-
console.log(result[0]); // 3
17+
console.log(result[0]);

folder-structure.md

-5
This file was deleted.

gulpfile.js

+1-36
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const fs = require('fs');
22
const gulp = require('gulp');
33
const rename = require('gulp-rename');
4-
const uglify = require('gulp-uglify-es').default;
5-
const gutil = require('gulp-util');
64
const header = require('gulp-header');
75
const browserSync = require('browser-sync');
86
const browserify = require('browserify');
@@ -13,7 +11,6 @@ const jsprettify = require('gulp-jsbeautifier');
1311
const stripComments = require('gulp-strip-comments');
1412
const merge = require('merge-stream');
1513

16-
1714
gulp.task('build', function() {
1815
const gpu = browserify('./src/browser.js')
1916
.ignore('gl')
@@ -65,7 +62,7 @@ gulp.task('bsync', function(){
6562
baseDir: './'
6663
},
6764
open: true,
68-
startPath: "/test/html/test-all.html",
65+
startPath: "./test/html/test-all.html",
6966
// Makes it easier to test on external mobile devices
7067
host: "0.0.0.0",
7168
tunnel: true
@@ -78,7 +75,6 @@ gulp.task('bsync', function(){
7875
/// Auto rebuild and host
7976
gulp.task('default', gulp.series('minify','bsync'));
8077

81-
8278
/// Beautify source code
8379
/// Use before merge request
8480
gulp.task('beautify', function() {
@@ -91,34 +87,3 @@ gulp.task('beautify', function() {
9187
.pipe(gulp.dest('src'));
9288
});
9389

94-
gulp.task('injectCSS', function() {
95-
const signatureColor = '#ff75cf';
96-
const linkColor = '#4c7fbd';
97-
const themeColor = '#186384';
98-
99-
// !important is used because the original rule is using it.
100-
const cssRules = `
101-
.signature, a {
102-
color: ${signatureColor};
103-
}
104-
105-
h4.name {
106-
background: ${themeColor};
107-
}
108-
109-
nav > ul > li > a, nav a:hover, nav > h2 > a {
110-
color: ${linkColor} !important;
111-
}
112-
113-
span.param-type, .params td .param-type {
114-
color: ${themeColor};
115-
}
116-
`;
117-
fs.appendFile('./doc/styles/jsdoc.css', cssRules, (err)=>{
118-
if (err) {
119-
throw new Error(err);
120-
}
121-
122-
console.log('CSS Injected');
123-
});
124-
});

index.d.ts

-212
This file was deleted.

0 commit comments

Comments
 (0)