Skip to content

Commit

Permalink
Merge pull request #480 from gpujs/rc-14-cleanup
Browse files Browse the repository at this point in the history
Rc 14 cleanup
  • Loading branch information
robertleeplummerjr committed Jun 3, 2019
2 parents 7fdc871 + 27f4efb commit 5726368
Show file tree
Hide file tree
Showing 236 changed files with 69,946 additions and 57,115 deletions.
133 changes: 98 additions & 35 deletions README.md

Large diffs are not rendered by default.

20,850 changes: 11,598 additions & 9,252 deletions bin/gpu-browser-core.js

Large diffs are not rendered by default.

20,854 changes: 11,600 additions & 9,254 deletions bin/gpu-browser-core.min.js

Large diffs are not rendered by default.

21,100 changes: 11,723 additions & 9,377 deletions bin/gpu-browser.js

Large diffs are not rendered by default.

21,104 changes: 11,725 additions & 9,379 deletions bin/gpu-browser.min.js

Large diffs are not rendered by default.

40 changes: 25 additions & 15 deletions examples/random.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@ <h2>WebGL2 Random</h2>
</body>
<script src="../bin/gpu-browser.js"></script>
<script>
const cpu = new GPU({
let cpu, webGL, webGL2;

cpu = new GPU({
mode: 'cpu',
canvas: document.getElementById('cpu-random-output')
});
const webGL = new GPU({
mode: 'webgl',
canvas: document.getElementById('web-gl-random-output')
});
const webGL2 = new GPU({
mode: 'webgl2',
canvas: document.getElementById('web-gl2-random-output')
});
try {
webGL = new GPU({
mode: 'webgl',
canvas: document.getElementById('web-gl-random-output')
});
} catch (e) {}
try {
webGL2 = new GPU({
mode: 'webgl2',
canvas: document.getElementById('web-gl2-random-output')
});
} catch (e) {}

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

const webGLDrawRandom = webGL.createKernel(drawRandomFunction)
.setGraphical(true)
.setOutput([100, 100]);
const webGLDrawRandom = webGL
? webGL.createKernel(drawRandomFunction)
.setGraphical(true)
.setOutput([100, 100])
: () => {};

const webGL2DrawRandom = webGL2.createKernel(drawRandomFunction)
.setGraphical(true)
.setOutput([100, 100]);
const webGL2DrawRandom = webGL2
? webGL2.createKernel(drawRandomFunction)
.setGraphical(true)
.setOutput([100, 100])
: () => {};

function draw() {
cpuDrawRandom();
Expand Down
102 changes: 52 additions & 50 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,64 @@ const stripComments = require('gulp-strip-comments');
const merge = require('merge-stream');

gulp.task('build', function() {
const gpu = browserify('./src/browser.js')
.ignore('gl')
.bundle()
.pipe(source('gpu-browser.js'))
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.on('error', console.error);
const gpu = browserify('./src/browser.js')
.ignore('gl')
.bundle()
.pipe(source('gpu-browser.js'))
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.on('error', console.error);

const gpuCore = browserify('./src/browser.js')
const gpuCore = browserify('./src/browser.js')
.ignore('gl')
.ignore('acorn')
.bundle()
.pipe(source('gpu-browser-core.js'))
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.on('error', console.error);
.ignore('acorn')
.bundle()
.pipe(source('gpu-browser-core.js'))
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.on('error', console.error);

return merge(gpu, gpuCore);
return merge(gpu, gpuCore);
});

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

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

return merge(gpu, gpuCore);
return merge(gpu, gpuCore);
});


/// The browser sync prototyping
gulp.task('bsync', function(){
// Syncs browser
browserSync.init({
server: {
baseDir: './'
},
open: true,
startPath: "./test/html/test-all.html",
// Makes it easier to test on external mobile devices
host: "0.0.0.0",
tunnel: true
});
// Syncs browser
browserSync.init({
server: {
baseDir: './'
},
open: true,
startPath: "./test/html/test-all.html",
// Makes it easier to test on external mobile devices
host: "0.0.0.0",
tunnel: true
});

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

/// Auto rebuild and host
Expand All @@ -78,12 +78,14 @@ gulp.task('default', gulp.series('minify','bsync'));
/// Beautify source code
/// Use before merge request
gulp.task('beautify', function() {
return gulp.src(['src/**/*.js'])
.pipe(jsprettify({
indent_size: 3,
indent_char: ' ',
indent_with_tabs: true
}))
.pipe(gulp.dest('src'));
return gulp.src(['src/**/*.js'])
.pipe(jsprettify({
indent_size: 2,
indent_char: ' ',
indent_with_tabs: false,
eol: '\n',
brace_style: 'preserve-inline'
}))
.pipe(gulp.dest('src'));
});

Loading

0 comments on commit 5726368

Please sign in to comment.