gpu.js/bin/gpu-core.min.js
Jonathan Todd 8201825f2e broken
2019-02-10 21:36:05 -06:00

15 lines
4.5 KiB
JavaScript

/**
* gpu.js
* http://gpu.rocks/
*
* GPU Accelerated JavaScript
*
* @version 1.10.4
* @date Sun Feb 10 2019 20:40:25 GMT-0600 (Central Standard Time)
*
* @license MIT
* The MIT License
*
* Copyright (c) 2019 gpu.js Team
*/
"use strict";!function(){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||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}return e}()({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()||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)}},{key:"isCanvasSupported",value:function(){return u}},{key:"initCanvas",value:function(){if(!u)return null;var e="undefined"!=typeof document?document.createElement("canvas"):new OffscreenCanvas(0,0);return e.width=2,e.height=2,e}},{key:"isWebGl",value:function(e){return e&&"function"==typeof e.getExtension}},{key:"isWebGl2",value:function(e){return e&&"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext}},{key:"isWebGlSupported",value:function(){return f}},{key:"isWebGl2Supported",value:function(){return c}},{key:"isWebGlDrawBuffersSupported",value:function(){return s}},{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);var t=null,r=e.initWebGlDefaultOptions();try{t=n.getContext("experimental-webgl",r)}catch(i){}return null===t&&(t=n.getContext("webgl2",r)||n.getContext("webgl",r)),t&&(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}},{key:"initWebGl2",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())}},{key:"checkOutput",value:function(e){if(!e||!Array.isArray(e))throw new Error("kernel.output not an array");for(var n=0;n<e.length;n++)if(isNaN(e[n])||e[n]<1)throw new Error("kernel.output["+n+"] incorrectly defined as `"+e[n]+"`, needs to be numeric, and greater than 0")}}]),e}(),u="undefined"!=typeof document?o.isCanvas(document.createElement("canvas")):"undefined"!=typeof OffscreenCanvas,a=o.initWebGl(o.initCanvas()),l=o.initWebGl2(o.initCanvas()),f=o.isWebGl(a),c=o.isWebGl2(l),s=f&&Boolean(a.getExtension("WEBGL_draw_buffers"));f?(o.OES_texture_float=a.OES_texture_float,o.OES_texture_float_linear=a.OES_texture_float_linear,o.OES_element_index_uint=a.OES_element_index_uint):(o.OES_texture_float=!1,o.OES_texture_float_linear=!1,o.OES_element_index_uint=!1),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]);