mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
gulp build
This commit is contained in:
parent
929f59fd14
commit
fa6491da42
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
# Built files
|
||||
bin/*.js
|
||||
doc/*
|
||||
|
||||
# Logs
|
||||
|
||||
192
bin/gpu-core.js
Normal file
192
bin/gpu-core.js
Normal file
@ -0,0 +1,192 @@
|
||||
/**
|
||||
* gpu.js
|
||||
* http://gpu.rocks/
|
||||
*
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 0.0.0
|
||||
* @date Tue Jul 18 2017 17:43:25 GMT+0530 (IST)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2017 gpu.js Team
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
(function e(t, n, r) {
|
||||
function s(o, u) {
|
||||
if (!n[o]) {
|
||||
if (!t[o]) {
|
||||
var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
|
||||
}var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
|
||||
var n = t[o][1][e];return s(n ? n : e);
|
||||
}, l, l.exports, e, t, n, r);
|
||||
}return n[o].exports;
|
||||
}var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
|
||||
s(r[o]);
|
||||
}return s;
|
||||
})({ 1: [function (require, module, exports) {
|
||||
'use strict';
|
||||
|
||||
var UtilsCore = require("./utils-core");
|
||||
|
||||
module.exports = function () {
|
||||
function GPUCore() {
|
||||
_classCallCheck(this, GPUCore);
|
||||
}
|
||||
|
||||
_createClass(GPUCore, null, [{
|
||||
key: "validateKernelObj",
|
||||
value: function validateKernelObj(kernelObj) {
|
||||
|
||||
if (kernelObj == null) {
|
||||
throw "KernelObj being validated is NULL";
|
||||
}
|
||||
|
||||
if (typeof kernelObj === "string") {
|
||||
try {
|
||||
kernelObj = JSON.parse(kernelObj);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
throw "Failed to convert KernelObj from JSON string";
|
||||
}
|
||||
|
||||
if (kernelObj == null) {
|
||||
throw "Invalid (NULL) KernelObj JSON string representation";
|
||||
}
|
||||
}
|
||||
|
||||
if (kernelObj.isKernelObj != true) {
|
||||
throw "Failed missing isKernelObj flag check";
|
||||
}
|
||||
|
||||
return kernelObj;
|
||||
}
|
||||
}, {
|
||||
key: "loadKernelObj",
|
||||
value: function loadKernelObj(kernelObj, inOpt) {
|
||||
|
||||
kernelObj = validateKernelObj(kernelObj);
|
||||
}
|
||||
}]);
|
||||
|
||||
return GPUCore;
|
||||
}();
|
||||
}, { "./utils-core": 2 }], 2: [function (require, module, exports) {
|
||||
'use strict';
|
||||
|
||||
var UtilsCore = function () {
|
||||
function UtilsCore() {
|
||||
_classCallCheck(this, UtilsCore);
|
||||
}
|
||||
|
||||
_createClass(UtilsCore, null, [{
|
||||
key: "isCanvas",
|
||||
value: function isCanvas(canvasObj) {
|
||||
return canvasObj !== null && canvasObj.nodeName && canvasObj.getContext && canvasObj.nodeName.toUpperCase() === 'CANVAS';
|
||||
}
|
||||
}, {
|
||||
key: "isCanvasSupported",
|
||||
value: function isCanvasSupported() {
|
||||
return _isCanvasSupported;
|
||||
}
|
||||
}, {
|
||||
key: "initCanvas",
|
||||
value: function initCanvas() {
|
||||
if (!_isCanvasSupported) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
canvas.width = 2;
|
||||
canvas.height = 2;
|
||||
|
||||
return canvas;
|
||||
}
|
||||
}, {
|
||||
key: "isWebGl",
|
||||
value: function isWebGl(webGlObj) {
|
||||
return webGlObj !== null && (webGlObj.__proto__ && webGlObj.__proto__.hasOwnProperty('getExtension') || webGlObj.prototype && webGlObj.prototype.hasOwnProperty('getExtension'));
|
||||
}
|
||||
}, {
|
||||
key: "isWebGlSupported",
|
||||
value: function isWebGlSupported() {
|
||||
return _isWebGlSupported;
|
||||
}
|
||||
}, {
|
||||
key: "isWebGlDrawBuffersSupported",
|
||||
value: function isWebGlDrawBuffersSupported() {
|
||||
return _isWebGlDrawBuffersSupported;
|
||||
}
|
||||
}, {
|
||||
key: "initWebGlDefaultOptions",
|
||||
value: function initWebGlDefaultOptions() {
|
||||
return {
|
||||
alpha: false,
|
||||
depth: false,
|
||||
antialias: false
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "initWebGl",
|
||||
value: function initWebGl(canvasObj) {
|
||||
|
||||
if (typeof _isCanvasSupported !== 'undefined' || canvasObj === null) {
|
||||
if (!_isCanvasSupported) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!UtilsCore.isCanvas(canvasObj)) {
|
||||
throw new Error('Invalid canvas object - ' + canvasObj);
|
||||
}
|
||||
|
||||
var webGl = canvasObj.getContext('experimental-webgl', UtilsCore.initWebGlDefaultOptions()) || canvasObj.getContext('webgl', UtilsCore.initWebGlDefaultOptions());
|
||||
|
||||
webGl.OES_texture_float = webGl.getExtension('OES_texture_float');
|
||||
webGl.OES_texture_float_linear = webGl.getExtension('OES_texture_float_linear');
|
||||
webGl.OES_element_index_uint = webGl.getExtension('OES_element_index_uint');
|
||||
|
||||
return webGl;
|
||||
}
|
||||
}]);
|
||||
|
||||
return UtilsCore;
|
||||
}();
|
||||
|
||||
var _isCanvasSupported = typeof document !== 'undefined' ? UtilsCore.isCanvas(document.createElement('canvas')) : false;
|
||||
var _testingWebGl = UtilsCore.initWebGl(UtilsCore.initCanvas());
|
||||
var _isWebGlSupported = UtilsCore.isWebGl(_testingWebGl);
|
||||
var _isWebGlDrawBuffersSupported = _isWebGlSupported && Boolean(_testingWebGl.getExtension('WEBGL_draw_buffers'));
|
||||
|
||||
if (_isWebGlSupported) {
|
||||
UtilsCore.OES_texture_float = _testingWebGl.OES_texture_float;
|
||||
UtilsCore.OES_texture_float_linear = _testingWebGl.OES_texture_float_linear;
|
||||
UtilsCore.OES_element_index_uint = _testingWebGl.OES_element_index_uint;
|
||||
} else {
|
||||
UtilsCore.OES_texture_float = false;
|
||||
UtilsCore.OES_texture_float_linear = false;
|
||||
UtilsCore.OES_element_index_uint = false;
|
||||
}
|
||||
|
||||
module.exports = UtilsCore;
|
||||
}, {}], 3: [function (require, module, exports) {
|
||||
'use strict';
|
||||
|
||||
var GPUCore = require("./core/gpu-core");
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = GPUCore;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
window.GPUCore = GPUCore;
|
||||
if (window.GPU === null) {
|
||||
window.GPU = GPUCore;
|
||||
}
|
||||
}
|
||||
}, { "./core/gpu-core": 1 }] }, {}, [3]);
|
||||
15
bin/gpu-core.min.js
vendored
Normal file
15
bin/gpu-core.min.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* gpu.js
|
||||
* http://gpu.rocks/
|
||||
*
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 0.0.0
|
||||
* @date Tue Jul 18 2017 17:43:09 GMT+0530 (IST)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2017 gpu.js Team
|
||||
*/
|
||||
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}();!function e(n,t,r){function i(a,l){if(!t[a]){if(!n[a]){var u="function"==typeof require&&require;if(!l&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var s=t[a]={exports:{}};n[a][0].call(s.exports,function(e){var t=n[a][1][e];return i(t?t:e)},s,s.exports,e,n,t,r)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,n,t){e("./utils-core");n.exports=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"validateKernelObj",value:function(e){if(null==e)throw"KernelObj being validated is NULL";if("string"==typeof e){try{e=JSON.parse(e)}catch(n){throw console.error(n),"Failed to convert KernelObj from JSON string"}if(null==e)throw"Invalid (NULL) KernelObj JSON string representation"}if(1!=e.isKernelObj)throw"Failed missing isKernelObj flag check";return e}},{key:"loadKernelObj",value:function(e,n){e=validateKernelObj(e)}}]),e}()},{"./utils-core":2}],2:[function(e,n,t){var r=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"isCanvas",value:function(e){return null!==e&&e.nodeName&&e.getContext&&"CANVAS"===e.nodeName.toUpperCase()}},{key:"isCanvasSupported",value:function(){return i}},{key:"initCanvas",value:function(){if(!i)return null;var e=document.createElement("canvas");return e.width=2,e.height=2,e}},{key:"isWebGl",value:function(e){return null!==e&&(e.__proto__&&e.__proto__.hasOwnProperty("getExtension")||e.prototype&&e.prototype.hasOwnProperty("getExtension"))}},{key:"isWebGlSupported",value:function(){return a}},{key:"isWebGlDrawBuffersSupported",value:function(){return l}},{key:"initWebGlDefaultOptions",value:function(){return{alpha:!1,depth:!1,antialias:!1}}},{key:"initWebGl",value:function(n){if(("undefined"!=typeof i||null===n)&&!i)return null;if(!e.isCanvas(n))throw new Error("Invalid canvas object - "+n);var t=n.getContext("experimental-webgl",e.initWebGlDefaultOptions())||n.getContext("webgl",e.initWebGlDefaultOptions());return t.OES_texture_float=t.getExtension("OES_texture_float"),t.OES_texture_float_linear=t.getExtension("OES_texture_float_linear"),t.OES_element_index_uint=t.getExtension("OES_element_index_uint"),t}}]),e}(),i="undefined"!=typeof document&&r.isCanvas(document.createElement("canvas")),o=r.initWebGl(r.initCanvas()),a=r.isWebGl(o),l=a&&Boolean(o.getExtension("WEBGL_draw_buffers"));a?(r.OES_texture_float=o.OES_texture_float,r.OES_texture_float_linear=o.OES_texture_float_linear,r.OES_element_index_uint=o.OES_element_index_uint):(r.OES_texture_float=!1,r.OES_texture_float_linear=!1,r.OES_element_index_uint=!1),n.exports=r},{}],3:[function(e,n,t){var r=e("./core/gpu-core");"undefined"!=typeof n&&(n.exports=r),"undefined"!=typeof window&&(window.GPUCore=r,null===window.GPU&&(window.GPU=r))},{"./core/gpu-core":1}]},{},[3]);
|
||||
15
bin/gpu.js
Normal file
15
bin/gpu.js
Normal file
File diff suppressed because one or more lines are too long
27
bin/gpu.min.js
vendored
Normal file
27
bin/gpu.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user