Skip to content

Commit 5726368

Browse files
Merge pull request #480 from gpujs/rc-14-cleanup
Rc 14 cleanup
2 parents 7fdc871 + 27f4efb commit 5726368

File tree

236 files changed

+69946
-57115
lines changed

Some content is hidden

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

236 files changed

+69946
-57115
lines changed

README.md

Lines changed: 98 additions & 35 deletions
Large diffs are not rendered by default.

bin/gpu-browser-core.js

Lines changed: 11598 additions & 9252 deletions
Large diffs are not rendered by default.

bin/gpu-browser-core.min.js

Lines changed: 11600 additions & 9254 deletions
Large diffs are not rendered by default.

bin/gpu-browser.js

Lines changed: 11723 additions & 9377 deletions
Large diffs are not rendered by default.

bin/gpu-browser.min.js

Lines changed: 11725 additions & 9379 deletions
Large diffs are not rendered by default.

examples/random.html

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ <h2>WebGL2 Random</h2>
1414
</body>
1515
<script src="../bin/gpu-browser.js"></script>
1616
<script>
17-
const cpu = new GPU({
17+
let cpu, webGL, webGL2;
18+
19+
cpu = new GPU({
1820
mode: 'cpu',
1921
canvas: document.getElementById('cpu-random-output')
2022
});
21-
const webGL = new GPU({
22-
mode: 'webgl',
23-
canvas: document.getElementById('web-gl-random-output')
24-
});
25-
const webGL2 = new GPU({
26-
mode: 'webgl2',
27-
canvas: document.getElementById('web-gl2-random-output')
28-
});
23+
try {
24+
webGL = new GPU({
25+
mode: 'webgl',
26+
canvas: document.getElementById('web-gl-random-output')
27+
});
28+
} catch (e) {}
29+
try {
30+
webGL2 = new GPU({
31+
mode: 'webgl2',
32+
canvas: document.getElementById('web-gl2-random-output')
33+
});
34+
} catch (e) {}
2935

3036
function drawRandomFunction() {
3137
this.color(Math.random(), Math.random(), Math.random());
@@ -35,13 +41,17 @@ <h2>WebGL2 Random</h2>
3541
.setGraphical(true)
3642
.setOutput([100, 100]);
3743

38-
const webGLDrawRandom = webGL.createKernel(drawRandomFunction)
39-
.setGraphical(true)
40-
.setOutput([100, 100]);
44+
const webGLDrawRandom = webGL
45+
? webGL.createKernel(drawRandomFunction)
46+
.setGraphical(true)
47+
.setOutput([100, 100])
48+
: () => {};
4149

42-
const webGL2DrawRandom = webGL2.createKernel(drawRandomFunction)
43-
.setGraphical(true)
44-
.setOutput([100, 100]);
50+
const webGL2DrawRandom = webGL2
51+
? webGL2.createKernel(drawRandomFunction)
52+
.setGraphical(true)
53+
.setOutput([100, 100])
54+
: () => {};
4555

4656
function draw() {
4757
cpuDrawRandom();

gulpfile.js

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,64 +12,64 @@ const stripComments = require('gulp-strip-comments');
1212
const merge = require('merge-stream');
1313

1414
gulp.task('build', function() {
15-
const gpu = browserify('./src/browser.js')
16-
.ignore('gl')
17-
.bundle()
18-
.pipe(source('gpu-browser.js'))
19-
.pipe(buffer())
20-
.pipe(stripComments())
21-
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
22-
.pipe(gulp.dest('bin'))
23-
.on('error', console.error);
15+
const gpu = browserify('./src/browser.js')
16+
.ignore('gl')
17+
.bundle()
18+
.pipe(source('gpu-browser.js'))
19+
.pipe(buffer())
20+
.pipe(stripComments())
21+
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
22+
.pipe(gulp.dest('bin'))
23+
.on('error', console.error);
2424

25-
const gpuCore = browserify('./src/browser.js')
25+
const gpuCore = browserify('./src/browser.js')
2626
.ignore('gl')
27-
.ignore('acorn')
28-
.bundle()
29-
.pipe(source('gpu-browser-core.js'))
30-
.pipe(buffer())
31-
.pipe(stripComments())
32-
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
33-
.pipe(gulp.dest('bin'))
34-
.on('error', console.error);
27+
.ignore('acorn')
28+
.bundle()
29+
.pipe(source('gpu-browser-core.js'))
30+
.pipe(buffer())
31+
.pipe(stripComments())
32+
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
33+
.pipe(gulp.dest('bin'))
34+
.on('error', console.error);
3535

36-
return merge(gpu, gpuCore);
36+
return merge(gpu, gpuCore);
3737
});
3838

3939
/// Minify the build script, after building it
4040
gulp.task('minify', function() {
41-
const gpu = gulp.src('bin/gpu-browser.js')
42-
.pipe(rename('gpu-browser.min.js'))
43-
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
44-
.pipe(gulp.dest('bin'))
45-
.on('error', console.error);
41+
const gpu = gulp.src('bin/gpu-browser.js')
42+
.pipe(rename('gpu-browser.min.js'))
43+
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
44+
.pipe(gulp.dest('bin'))
45+
.on('error', console.error);
4646

47-
const gpuCore = gulp.src('bin/gpu-browser-core.js')
48-
.pipe(rename('gpu-browser-core.min.js'))
49-
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
50-
.pipe(gulp.dest('bin'))
51-
.on('error', console.error);
47+
const gpuCore = gulp.src('bin/gpu-browser-core.js')
48+
.pipe(rename('gpu-browser-core.min.js'))
49+
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
50+
.pipe(gulp.dest('bin'))
51+
.on('error', console.error);
5252

53-
return merge(gpu, gpuCore);
53+
return merge(gpu, gpuCore);
5454
});
5555

5656

5757
/// The browser sync prototyping
5858
gulp.task('bsync', function(){
59-
// Syncs browser
60-
browserSync.init({
61-
server: {
62-
baseDir: './'
63-
},
64-
open: true,
65-
startPath: "./test/html/test-all.html",
66-
// Makes it easier to test on external mobile devices
67-
host: "0.0.0.0",
68-
tunnel: true
69-
});
59+
// Syncs browser
60+
browserSync.init({
61+
server: {
62+
baseDir: './'
63+
},
64+
open: true,
65+
startPath: "./test/html/test-all.html",
66+
// Makes it easier to test on external mobile devices
67+
host: "0.0.0.0",
68+
tunnel: true
69+
});
7070

71-
// Detect change -> rebuild TS
72-
gulp.watch(['src/**.js'], ['minify']);
71+
// Detect change -> rebuild TS
72+
gulp.watch(['src/**.js'], ['minify']);
7373
});
7474

7575
/// Auto rebuild and host
@@ -78,12 +78,14 @@ gulp.task('default', gulp.series('minify','bsync'));
7878
/// Beautify source code
7979
/// Use before merge request
8080
gulp.task('beautify', function() {
81-
return gulp.src(['src/**/*.js'])
82-
.pipe(jsprettify({
83-
indent_size: 3,
84-
indent_char: ' ',
85-
indent_with_tabs: true
86-
}))
87-
.pipe(gulp.dest('src'));
81+
return gulp.src(['src/**/*.js'])
82+
.pipe(jsprettify({
83+
indent_size: 2,
84+
indent_char: ' ',
85+
indent_with_tabs: false,
86+
eol: '\n',
87+
brace_style: 'preserve-inline'
88+
}))
89+
.pipe(gulp.dest('src'));
8890
});
8991

0 commit comments

Comments
 (0)