mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
15 lines
3.0 KiB
JavaScript
15 lines
3.0 KiB
JavaScript
/**
|
|
* gpu.js
|
|
* http://gpu.rocks/
|
|
*
|
|
* GPU Accelerated JavaScript
|
|
*
|
|
* @version 1.0.0
|
|
* @date Sat Feb 24 2018 19:31:19 GMT-0500 (EST)
|
|
*
|
|
* @license MIT
|
|
* The MIT License
|
|
*
|
|
* Copyright (c) 2018 gpu.js Team
|
|
*/
|
|
"use strict";!function e(n,t,r){function i(u,a){if(!t[u]){if(!n[u]){var l="function"==typeof require&&require;if(!a&&l)return l(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var c=t[u]={exports:{}};n[u][0].call(c.exports,function(e){var t=n[u][1][e];return i(t?t:e)},c,c.exports,e,n,t,r)}return t[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,n,t){function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=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}}();e("./utils-core");n.exports=function(){function e(){r(this,e)}return i(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(e.isKernelObj!==!0)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){function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=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}}(),o=function(){function e(){r(this,e)}return i(e,null,[{key:"isCanvas",value:function(e){return null!==e&&e.nodeName&&e.getContext&&"CANVAS"===e.nodeName.toUpperCase()}},{key:"isCanvasSupported",value:function(){return u}},{key:"initCanvas",value:function(){if(!u)return null;var e=document.createElement("canvas");return e.width=2,e.height=2,e}},{key:"isWebGl",value:function(e){return e&&"function"==typeof e.getExtension}},{key:"isWebGlSupported",value:function(){return l}},{key:"isWebGlDrawBuffersSupported",value:function(){return f}},{key:"initWebGlDefaultOptions",value:function(){return{alpha:!1,depth:!1,antialias:!1}}},{key:"initWebGl",value:function(n){if(("undefined"!=typeof u||null===n)&&!u)return null;if(!e.isCanvas(n))throw new Error("Invalid canvas object - "+n);return n.getContext("webgl2",e.initWebGlDefaultOptions())}}]),e}(),u="undefined"!=typeof document&&o.isCanvas(document.createElement("canvas")),a=o.initWebGl(o.initCanvas()),l=o.isWebGl(a),f=l;n.exports=o},{}],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]); |