diff --git a/dist/blink.js b/dist/blink.js index 05372bf..3011e9a 100644 --- a/dist/blink.js +++ b/dist/blink.js @@ -168,6 +168,9 @@ function closestDimensions(area) { return [width, area / width] } +/** + * Internal (helper) class. + */ class Texture { constructor(internalFormat, width, height, format, type, data, alignment, wrapS, wrapT) { const previousTex = gl.getParameter(gl.TEXTURE_BINDING_2D); @@ -216,7 +219,7 @@ class Texture { upload(data) { gl.bindTexture(gl.TEXTURE_2D, this.id); gl.texImage2D(gl.TEXTURE_2D, 0, gl[this.internalFormat], this.width, this.height, 0, gl[this.format], gl[this.type], data); - gl.bindTexture(gl.TEXTURE_2D, this.id); + gl.bindTexture(gl.TEXTURE_2D, null); return this } @@ -239,6 +242,22 @@ function withTemporaryFBO(fn) { gl.deleteFramebuffer(fbo); } +/** + * The `Buffer` object allocates memory on the host. Once the `Buffer` + * is requested on the device (GPU), the contents of `Buffer`'s data + * are allocated and copied from the host to the device. + * + * Once te device is done computing, the contents of the `Buffer` on + * the device are copied back to the host. + * + * All device copies are stored and mainted through `BufferCache`. + * + * NOTE: Data of a `Buffer` are NOT retained on the device. Once the + * data has been copied back to the host, the device copy will be + * destroyed immediately. To retain data on the device, please use + * the `DeviceBuffer` object. + */ + let readablesMap = new WeakMap(); let writablesMap = new WeakMap(); @@ -335,6 +354,16 @@ function textureForBuffer(buffer, data = null, wrap) { return new Texture(internalFormat, width, height, format, type, data, bytes, ...buffer.wrap) } +/** + * The `DeviceBuffer` only allocates memory on the host. Memory is + * allocated the moment the `DeviceBuffer` is constructed. Memory + * on the device is developer managed. Indeed, the device memory is + * retained until the developer destroys the `DeviceBuffer` using + * the `destroy()` method. + * + * Memory from the host can be copied to the device and vice versa. + */ + class DeviceBuffer { constructor({alloc, data, type = FLOAT, vector = 1, wrap = CLAMP}) { this.vector = Math.min(Math.max(vector, 1), 4); @@ -440,9 +469,15 @@ class DeviceBuffer { _finish() { // Swap. - this._getReadable().delete(); - readablesMap.set(this, this._getWritable()); - writablesMap.delete(this); + let writableCopy = this._getWritable(); + if (writableCopy) { + let readableCopy = this._getReadable(); + if (readableCopy) { + readableCopy.delete(); + } + readablesMap.set(this, writableCopy); + writablesMap.delete(this); + } } } @@ -458,6 +493,7 @@ void main() { bl_UV = pos * 0.5 + 0.5; }`; +// Keep the vertex shader in memory. const vertexShader = compileShader(gl.VERTEX_SHADER, vertexSource); /** @@ -779,7 +815,7 @@ function prepareFragmentShader(inputs, outputDescriptors, source) { const VERSION = { major: 0, minor: 2, - patch: 3, + patch: 4, toString() { return `${this.major}.${this.minor}.${this.patch}` } }; @@ -803,4 +839,3 @@ exports.MIRROR = MIRROR; Object.defineProperty(exports, '__esModule', { value: true }); }))); -//# sourceMappingURL=blink.js.map diff --git a/dist/blink.js.map b/dist/blink.js.map deleted file mode 100644 index e172558..0000000 --- a/dist/blink.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"blink.js","sources":["../src/WebGL/Context.js","../src/common.js","../src/WebGL/Texture.js","../src/Buffer.js","../src/DeviceBuffer.js","../src/shaders/quad.vert","../src/WebGL/Program.js","../src/shaders/template.frag","../src/Kernel.js","../src/index.js"],"sourcesContent":["/**\r\n * WebGL 2.0 related objects and helpers.\r\n */\r\nexport const gl = function () {\r\n\tconst canvas = document.createElement('canvas')\r\n\tcanvas.width = canvas.height = 1\r\n\r\n\tconst options = {\r\n\t\talpha: false,\r\n\t\tantialias: false,\r\n\t\tdepth: false,\r\n\t\tstencil: false,\r\n\t}\r\n\r\n\tlet gl = canvas.getContext('webgl2', options)\r\n\r\n\tif (!gl) {\r\n\t\tthrow new Error('WebGL 2.0 not supported by the browser.')\r\n\t}\r\n\telse if (!(gl.floatExt = gl.getExtension('EXT_color_buffer_float'))) {\r\n\t\tthrow new Error('EXT_color_buffer_float not supported.')\r\n\t}\r\n\r\n\tgl.pixelStorei(gl.PACK_ALIGNMENT, 1)\r\n\tgl.pixelStorei(gl.UNPACK_ALIGNMENT, 1)\r\n\r\n\treturn gl\r\n}()\r\n\r\n\r\nexport const device = function () {\r\n\tlet device = {\r\n\t\tglslVersion: gl.getParameter(gl.SHADING_LANGUAGE_VERSION),\r\n\t\tmaxColorAttachments: gl.getParameter(gl.MAX_DRAW_BUFFERS),\r\n\t\tmaxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),\r\n\t\tmaxTextureUnits: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\r\n\t\trenderer: gl.getParameter(gl.RENDERER),\r\n\t\tvendor: gl.getParameter(gl.VENDOR),\r\n\t}\r\n\r\n\tconst debugRendererInfo = gl.getExtension('WEBGL_debug_renderer_info')\r\n\tif (debugRendererInfo) {\r\n\t\tdevice.unmaskedRenderer = gl.getParameter(debugRendererInfo.UNMASKED_RENDERER_WEBGL),\r\n\t\tdevice.unmaskedVendor = gl.getParameter(debugRendererInfo.UNMASKED_VENDOR_WEBGL)\r\n\t}\r\n\r\n\treturn Object.freeze(device)\r\n}()\r\n\r\n\r\nexport const quadVAO = function () {\r\n\t// Quad vertices.\r\n\tconst vertices = new Float32Array([-1, 1, -1, -1, 1, 1, 1, -1])\r\n\tlet vbo = gl.createBuffer()\r\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo)\r\n\tgl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW)\r\n\tgl.bindBuffer(gl.ARRAY_BUFFER, null)\r\n\r\n\t// Quad VAO.\r\n\tlet vao = gl.createVertexArray()\r\n\tgl.bindVertexArray(vao)\r\n\r\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo)\r\n\tgl.enableVertexAttribArray(0)\r\n\tgl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0)\r\n\r\n\tgl.bindVertexArray(null)\r\n\tgl.bindBuffer(gl.ARRAY_BUFFER, null)\r\n\r\n\treturn vao\r\n}()","// Buffer types.\r\nconst type = (name, bytes, integer, unsigned) => Object.freeze({ name, bytes, integer, unsigned })\r\n\r\nexport const FLOAT = type('float', 4, false, false)\r\nexport const INT32 = type('int32', 4, true, false)\r\nexport const INT16 = type('int16', 2, true, false)\r\nexport const INT8 = type('int8', 1, true, false)\r\nexport const UINT32 = type('uint32', 4, true, true)\r\nexport const UINT16 = type('uint16', 2, true, true)\r\nexport const UINT8 = type('uint8', 1, true, true)\r\n\r\n// Wrap modes for the textures.\r\nexport const CLAMP = 33071\r\nexport const REPEAT = 10497\r\nexport const MIRROR = 33648\r\n\r\n\r\n// TypedArray helpers.\r\nexport const arrayConstructors = new Map([\r\n\t[FLOAT, Float32Array],\r\n\t[INT32, Int32Array],\r\n\t[INT16, Int16Array],\r\n\t[INT8, Int8Array],\r\n\t[UINT32, Uint32Array],\r\n\t[UINT16, Uint16Array],\r\n\t[UINT8, Uint8Array],\r\n])\r\n\r\nexport const arrayTypes = new Map([\r\n\t[Float32Array, FLOAT],\r\n\t[Int32Array, INT32],\r\n\t[Int16Array, INT16],\r\n\t[Int8Array, INT8],\r\n\t[Uint32Array, UINT32],\r\n\t[Uint16Array, UINT16],\r\n\t[Uint8Array, UINT8],\r\n\t[Uint8ClampedArray, UINT8],\r\n])\r\n\r\n\r\n/// Hands out all the types associated with a Buffer's data.\r\nexport function formatInfo(dataType, vectorSize = 1) {\r\n\tconst { bytes, integer, unsigned } = dataType\r\n\r\n\tconst precision = ['lowp', 'mediump', null, 'highp'][bytes - 1]\r\n\r\n\tconst inputType = integer && unsigned ? 'usampler2D' : integer ? 'isampler2D' : 'sampler2D'\r\n\r\n\tlet outputType = null\r\n\tif (vectorSize == 1) {\r\n\t\toutputType = integer && unsigned ? 'uint' : integer ? 'int' : 'float'\r\n\t}\r\n\telse {\r\n\t\toutputType = integer && unsigned ? 'uvec' : integer ? 'ivec' : 'vec'\r\n\t\toutputType += vectorSize\r\n\t}\r\n\r\n\tlet internalFormat = ['R', 'RG', 'RGB', 'RGBA'][vectorSize - 1]\r\n\tinternalFormat += bytes * 8 // 8, 16 or 32\r\n\tinternalFormat += integer && unsigned ? 'UI' : integer ? 'I' : 'F'\r\n\r\n\tlet format = ['RED', 'RG', 'RGB', 'RGBA'][vectorSize - 1]\r\n\tformat += integer ? '_INTEGER' : ''\r\n\r\n\tlet type = ''\r\n\tif (integer) {\r\n\t\tif (unsigned) {\r\n\t\t\ttype = 'UNSIGNED_'\r\n\t\t}\r\n\t\ttype += bytes == 1 ? 'BYTE' : bytes == 2 ? 'SHORT' : 'INT'\r\n\t}\r\n\telse {\r\n\t\ttype = 'FLOAT'\r\n\t}\r\n\r\n\treturn {\r\n\t\tbytes, format, internalFormat,\r\n\t\tinputType, integer, outputType,\r\n\t\tprecision, type, unsigned,\r\n\t}\r\n}\r\n\r\n\r\n/// http://stackoverflow.com/a/16267018/4757748\r\nexport function closestDimensions(area) {\r\n\tlet width = Math.floor(Math.sqrt(area))\r\n\twhile (area % width && width > 1) {\r\n\t\twidth -= 1\r\n\t}\r\n\treturn [width, area / width]\r\n}","import { gl } from './Context'\r\n\r\n/**\r\n * Internal (helper) class.\r\n */\r\nexport class Texture {\r\n\tconstructor(internalFormat, width, height, format, type, data, alignment, wrapS, wrapT) {\r\n\t\tconst previousTex = gl.getParameter(gl.TEXTURE_BINDING_2D)\r\n\r\n\t\tthis.internalFormat = internalFormat\r\n\t\tthis.width = width\r\n\t\tthis.height = height\r\n\t\tthis.format = format\r\n\t\tthis.type = type\r\n\t\tthis.alignment = alignment\r\n\r\n\t\tthis.id = gl.createTexture()\r\n\t\tgl.bindTexture(gl.TEXTURE_2D, this.id)\r\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS || gl.CLAMP_TO_EDGE)\r\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT || gl.CLAMP_TO_EDGE)\r\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)\r\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)\r\n\t\tgl.texImage2D(gl.TEXTURE_2D, 0, gl[this.internalFormat], width, height, 0, gl[this.format], gl[this.type], data)\r\n\r\n\t\tgl.bindTexture(gl.TEXTURE_2D, previousTex)\r\n\t}\r\n\r\n\tdelete() {\r\n\t\tif (gl.getParameter(gl.TEXTURE_BINDING_2D) == this.id) {\r\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, null)\r\n\t\t}\r\n\t\tgl.deleteTexture(this.id)\r\n\t\tdelete this.id\r\n\t}\r\n\r\n\tcopy() {\r\n\t\tlet copy = new Texture(this.internalFormat, this.width, this.height, this.format, this.type, null, this.alignment)\r\n\r\n\t\twithTemporaryFBO(() => {\r\n\t\t\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.id, 0)\r\n\t\t\tgl.readBuffer(gl.COLOR_ATTACHMENT0)\r\n\r\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, copy.id)\r\n\t\t\tgl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, this.width, this.height, 0)\r\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, null)\r\n\t\t})\t\t\r\n\r\n\t\treturn copy\r\n\t}\r\n\r\n\tupload(data) {\r\n\t\tgl.bindTexture(gl.TEXTURE_2D, this.id)\r\n\t\tgl.texImage2D(gl.TEXTURE_2D, 0, gl[this.internalFormat], this.width, this.height, 0, gl[this.format], gl[this.type], data)\r\n\t\tgl.bindTexture(gl.TEXTURE_2D, this.id)\r\n\t\treturn this\r\n\t}\r\n\r\n\tread(data) {\r\n\t\twithTemporaryFBO(() => {\r\n\t\t\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.id, 0)\r\n\t\t\tgl.readBuffer(gl.COLOR_ATTACHMENT0)\r\n\t\t\tgl.readPixels(0, 0, this.width, this.height, gl[this.format], gl[this.type], data, 0)\r\n\t\t})\r\n\t\treturn true\r\n\t}\r\n}\r\n\r\nfunction withTemporaryFBO(fn) {\r\n\tlet previousFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING)\r\n\tlet fbo = gl.createFramebuffer()\r\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\r\n\tfn()\r\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, previousFBO)\r\n\tgl.deleteFramebuffer(fbo)\r\n}","import * as common from './common'\r\nimport { device } from './WebGL/Context'\r\nimport { Texture } from './WebGL/Texture'\r\n\r\n/**\r\n * The `Buffer` object allocates memory on the host. Once the `Buffer`\r\n * is requested on the device (GPU), the contents of `Buffer`'s data\r\n * are allocated and copied from the host to the device.\r\n * \r\n * Once te device is done computing, the contents of the `Buffer` on\r\n * the device are copied back to the host.\r\n *\r\n * All device copies are stored and mainted through `BufferCache`.\r\n *\r\n * NOTE: Data of a `Buffer` are NOT retained on the device. Once the\r\n * data has been copied back to the host, the device copy will be\r\n * destroyed immediately. To retain data on the device, please use\r\n * the `DeviceBuffer` object.\r\n */\r\n\r\nexport let readablesMap = new WeakMap()\r\nexport let writablesMap = new WeakMap()\r\n\r\nexport class Buffer {\r\n\tconstructor({alloc, data, type = common.FLOAT, vector = 1, wrap = common.CLAMP}) {\r\n\t\tthis.vector = Math.min(Math.max(vector, 1), 4)\r\n\t\tif (this.vector == 3) {\r\n\t\t\tconsole.warn('Vector size of 3 not supported. Choosing vector size 4.')\r\n\t\t\tthis.vector = 4\r\n\t\t}\r\n\r\n\t\tlet size = alloc || data.length\r\n\t\tthis.dimensions = common.closestDimensions(size / this.vector)\r\n\r\n\t\t// Wrap mode for S and T.\r\n\t\tthis.wrap = Array.isArray(wrap) ? wrap : [wrap, wrap]\r\n\r\n\t\tconst maxDimension = device.maxTextureSize ** 2\r\n\t\tif (Math.max(...this.dimensions) > maxDimension) {\r\n\t\t\tthrow new Error('Buffer size exceeds device limit.')\r\n\t\t}\r\n\r\n\t\tif (alloc != null) {\r\n\t\t\tconst typedArray = common.arrayConstructors.get(type)\r\n\t\t\tthis.data = new typedArray(size)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (data instanceof Uint8ClampedArray) {\r\n\t\t\t\tthis.data = new Uint8Array(data.buffer)\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis.data = data\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tdelete() {\r\n\t\tdelete this.data\r\n\t\tthis._finish()\r\n\t}\r\n\r\n\tcopy() {\r\n\t\treturn new Buffer({\r\n\t\t\tdata: new this.data.constructor(this.data),\r\n\t\t\tvector: this.vector,\r\n\t\t})\r\n\t}\r\n\r\n\t/// Private methods / properties.\r\n\r\n\tget formatInfo() {\r\n\t\tfor (const [constructor, type] of common.arrayTypes) {\r\n\t\t\tif (this.data instanceof constructor) {\r\n\t\t\t\treturn common.formatInfo(type, this.vector)\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null\r\n\t}\r\n\r\n\t_getReadable(forceCreate = false) {\r\n\t\tif (!readablesMap.has(this) && forceCreate) {\r\n\t\t\tconst readable = textureForBuffer(this, this.data)\t\r\n\t\t\treadablesMap.set(this, readable)\r\n\t\t}\r\n\t\treturn readablesMap.get(this)\r\n\t}\r\n\r\n\t_getWritable(forceCreate = false) {\r\n\t\tif (!writablesMap.has(this) && forceCreate) {\r\n\t\t\tconst writable = textureForBuffer(this, this.data)\r\n\t\t\twritablesMap.set(this, writable)\r\n\t\t}\r\n\t\treturn writablesMap.get(this)\r\n\t}\r\n\r\n\t_finish() {\r\n\t\tlet readable = this._getReadable()\r\n\t\tif (readable) {\r\n\t\t\treadable.delete()\r\n\t\t\treadablesMap.delete(this)\r\n\t\t}\r\n\r\n\t\tlet writable = this._getWritable()\r\n\t\tif (writable) {\r\n\t\t\twritable.delete()\r\n\t\t\twritablesMap.delete(this)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction textureForBuffer(buffer, data = null, wrap) {\r\n\tconst { bytes, internalFormat, format, type } = buffer.formatInfo\r\n\tconst [width, height] = buffer.dimensions\r\n\treturn new Texture(internalFormat, width, height, format, type, data, bytes, ...buffer.wrap)\r\n}","import * as common from './common'\r\nimport { device } from './WebGL/Context'\r\nimport { Texture } from './WebGL/Texture'\r\n\r\nimport { readablesMap, writablesMap } from './Buffer'\r\n\r\n/**\r\n * The `DeviceBuffer` only allocates memory on the host. Memory is\r\n * allocated the moment the `DeviceBuffer` is constructed. Memory\r\n * on the device is developer managed. Indeed, the device memory is\r\n * retained until the developer destroys the `DeviceBuffer` using\r\n * the `destroy()` method.\r\n *\r\n * Memory from the host can be copied to the device and vice versa.\r\n */\r\n\r\nexport class DeviceBuffer {\r\n\tconstructor({alloc, data, type = common.FLOAT, vector = 1, wrap = common.CLAMP}) {\r\n\t\tthis.vector = Math.min(Math.max(vector, 1), 4)\r\n\t\tif (this.vector == 3) {\r\n\t\t\tconsole.warn('Vector size of 3 not supported. Choosing vector size 4.')\r\n\t\t\tthis.vector = 4\r\n\t\t}\r\n\r\n\t\tthis.size = alloc || data.length\r\n\t\tthis.dimensions = common.closestDimensions(this.size / this.vector)\r\n\r\n\t\t// Wrap mode for S and T.\r\n\t\tthis.wrap = Array.isArray(wrap) ? wrap : [wrap, wrap]\r\n\r\n\t\tconst maxDimension = device.maxTextureSize ** 2\r\n\t\tif (Math.max(...this.dimensions) > maxDimension) {\r\n\t\t\tthrow new Error('Buffer size exceeds device limit.')\r\n\t\t}\r\n\t\t\r\n\t\tlet associatedType = type\r\n\t\tif (data) {\r\n\t\t\tfor (const [constructor, type] of common.arrayTypes) {\r\n\t\t\t\tif (data instanceof constructor) {\r\n\t\t\t\t\tassociatedType = type\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.type = associatedType\r\n\r\n\t\t// Allocate on the device, immediately.\r\n\t\tlet texture = this._getReadable(true)\r\n\r\n\t\tif (data) {\r\n\t\t\tif (data.constructor == Uint8ClampedArray) {\r\n\t\t\t\tdata = new Uint8Array(data.buffer)\r\n\t\t\t}\r\n\t\t\ttexture.upload(data)\r\n\t\t}\r\n\t}\r\n\r\n\tdelete() {\r\n\t\tif (readablesMap.has(this)) {\r\n\t\t\treadablesMap.get(this).delete()\r\n\t\t\treadablesMap.delete(this)\r\n\t\t}\r\n\t}\r\n\r\n\tcopy() {\r\n\t\tlet copyReadable = this._readable.copy()\r\n\t\tlet copyBuffer = new DeviceBuffer({\r\n\t\t\talloc: this.size,\r\n\t\t\ttype: this.type,\r\n\t\t\tvector: this.vector\r\n\t\t})\r\n\r\n\t\tcopyBuffer._readable.delete()\r\n\t\tcopyBuffer._readable = copyReadable\r\n\t\treturn copyBuffer\r\n\t}\r\n\r\n\ttoDevice(data) {\r\n\t\tthis._getReadable().upload(data)\r\n\t}\r\n\r\n\ttoHost(data) {\r\n\t\tif (!data) {\r\n\t\t\tconst typedArray = common.arrayConstructors.get(this.type)\r\n\t\t\tdata = new typedArray(this.size)\r\n\t\t}\r\n\r\n\t\t// Cast Uint8ClampedArray to Uint8Array.\r\n\t\tlet ref = data\r\n\t\tif (data instanceof Uint8ClampedArray) {\r\n\t\t\tref = new Uint8Array(data.buffer)\r\n\t\t}\r\n\t\tthis._getReadable().read(ref)\r\n\r\n\t\treturn data\r\n\t}\r\n\r\n\t/// Private methods / properties.\r\n\r\n\tget formatInfo() {\r\n\t\treturn common.formatInfo(this.type, this.vector)\r\n\t}\r\n\r\n\t_getReadable(forceCreate = false) {\r\n\t\tif (!readablesMap.has(this) && forceCreate) {\r\n\t\t\tconst { bytes, internalFormat, format, type } = this.formatInfo\r\n\t\t\tconst [width, height] = this.dimensions\r\n\t\t\treadablesMap.set(this, new Texture(internalFormat, width, height, format, type, null, bytes, ...this.wrap))\r\n\t\t}\r\n\t\treturn readablesMap.get(this)\r\n\t}\r\n\r\n\t_getWritable(forceCreate = false) {\r\n\t\tif (!writablesMap.has(this) && forceCreate) {\r\n\t\t\twritablesMap.set(this, this._getReadable(true).copy())\r\n\t\t}\r\n\t\treturn writablesMap.get(this)\r\n\t}\r\n\r\n\t_finish() {\r\n\t\t// Swap.\r\n\t\tthis._getReadable().delete()\r\n\t\treadablesMap.set(this, this._getWritable())\r\n\t\twritablesMap.delete(this)\r\n\t}\r\n}","export default `#version 300 es\r\n\r\nprecision highp float;\r\n\r\nlayout(location = 0) in vec2 pos;\r\nout vec2 bl_UV;\r\n\r\nvoid main() {\r\n\tgl_Position = vec4(pos, 0.0, 1.0);\r\n\tbl_UV = pos * 0.5 + 0.5;\r\n}`","import { gl } from './Context'\r\nimport vertexSource from './../shaders/quad.vert'\r\n\r\n// Keep the vertex shader in memory.\r\nconst vertexShader = compileShader(gl.VERTEX_SHADER, vertexSource)\r\n\r\n/**\r\n * Internal (helper) class.\r\n */\r\nexport class Program {\r\n\tconstructor(fragSource) {\r\n\t\tlet fragShader = compileShader(gl.FRAGMENT_SHADER, fragSource)\r\n\r\n\t\tthis.id = gl.createProgram()\r\n\t\tgl.attachShader(this.id, vertexShader)\r\n\t\tgl.attachShader(this.id, fragShader)\r\n\t\tgl.deleteShader(fragShader)\r\n\r\n\t\tgl.linkProgram(this.id)\r\n\r\n\t\tif (!gl.getProgramParameter(this.id, gl.LINK_STATUS)) {\r\n\t\t\tconsole.error('Unable to link program. Info log:')\r\n\t\t\tconsole.warn(gl.getProgramInfoLog(this.id))\r\n\t\t\treturn null\r\n\t\t}\r\n\r\n\t\t// Get attributes and uniforms.\r\n\t\tthis.attributes = {}\r\n\t\tconst attribCount = gl.getProgramParameter(this.id, gl.ACTIVE_ATTRIBUTES)\r\n\t\tfor (let a = 0; a < attribCount; a++) {\r\n\t\t\tlet attribute = gl.getActiveAttrib(this.id, a)\r\n\t\t\tattribute.id = gl.getAttribLocation(this.id, attribute.name)\r\n\t\t\tthis.attributes[attribute.name] = attribute\r\n\t\t}\r\n\r\n\t\tthis.uniforms = {}\r\n\t\tconst uniformCount = gl.getProgramParameter(this.id, gl.ACTIVE_UNIFORMS)\r\n\t\tfor (let u = 0; u < uniformCount; u++) {\r\n\t\t\tlet uniform = gl.getActiveUniform(this.id, u)\r\n\t\t\tuniform.id = gl.getUniformLocation(this.id, uniform.name)\r\n\t\t\tthis.uniforms[uniform.name] = uniform\r\n\t\t}\r\n\t}\r\n\r\n\tdelete() {\r\n\t\tgl.deleteProgram(this.id)\r\n\t\tdelete this.id\r\n\t}\r\n\r\n\tsetUniform(name, ...values) {\r\n\t\tif (!this.uniforms[name]) {\r\n\t\t\t// console.warn(`${name} not a valid uniform.`)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tconst { id, size, type } = this.uniforms[name]\r\n\t\r\n\t\tlet fnName = uniformsFnTable[type]\r\n\t\tif (size > 1 && fnName[fnName.length - 1] != 'v') {\r\n\t\t\tfnName += 'v'\r\n\t\t}\r\n\r\n\t\tif (fnName.indexOf('Matrix') == -1) {\r\n\t\t\tgl[fnName](id, ...values)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tgl[fnName](id, false, ...values)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction compileShader(type, source) {\r\n\t// Check if the shader defines glsl version.\r\n\tif (!(/^#version 300 es/g).test(source)) {\r\n\t\tsource = '#version 300 es\\n\\r' + source\r\n\t}\r\n\r\n\tlet shader = gl.createShader(type)\r\n\tgl.shaderSource(shader, source)\r\n\tgl.compileShader(shader)\r\n\r\n\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\r\n\t\t// TODO: Better error logging.\r\n\t\tconst typeName = type == gl.VERTEX_SHADER ? 'vertex' : 'fragment'\r\n\t\tconst infoLog = gl.getShaderInfoLog(shader)\r\n\t\tthrow new Error(`Unable to compile ${typeName} shader. Info log: \r\n\t\t\t${infoLog}`)\r\n\t}\r\n\r\n\treturn shader\r\n}\r\n\r\nconst uniformsFnTable = {\r\n\t[gl.FLOAT]: 'uniform1f',\r\n\t[gl.FLOAT_VEC2]: 'uniform2f',\r\n\t[gl.FLOAT_VEC3]: 'uniform3f',\r\n\t[gl.FLOAT_VEC4]: 'uniform4f',\r\n\t[gl.INT]: 'uniform1i',\r\n\t[gl.INT_VEC2]: 'uniform2i',\r\n\t[gl.INT_VEC3]: 'uniform3i',\r\n\t[gl.INT_VEC4]: 'uniform4i',\r\n\t[gl.UNSIGNED_INT]: 'uniform1ui',\r\n\t[gl.UNSIGNED_INT_VEC2]: 'uniform2ui',\r\n\t[gl.UNSIGNED_INT_VEC3]: 'uniform3ui',\r\n\t[gl.UNSIGNED_INT_VEC4]: 'uniform4ui',\r\n\t[gl.BOOL]: 'uniform1i',\r\n\t[gl.BOOL_VEC2]: 'uniform2i',\r\n\t[gl.BOOL_VEC3]: 'uniform3i',\r\n\t[gl.BOOL_VEC4]: 'uniform4i',\r\n\t[gl.FLOAT_MAT2]: 'uniformMatrix2fv',\r\n\t[gl.FLOAT_MAT2x3]: 'uniformMatrix2x3fv',\r\n\t[gl.FLOAT_MAT2x4]: 'uniformMatrix2x4fv',\r\n\t[gl.FLOAT_MAT3]: 'uniformMatrix3fv',\r\n\t[gl.FLOAT_MAT3x2]: 'uniformMatrix3x2fv',\r\n\t[gl.FLOAT_MAT3x4]: 'uniformMatrix3x4fv',\r\n\t[gl.FLOAT_MAT4]: 'uniformMatrix4fv',\r\n\t[gl.FLOAT_MAT4x2]: 'uniformMatrix4x2fv',\r\n\t[gl.FLOAT_MAT4x3]: 'uniformMatrix4x3fv',\r\n\t[gl.SAMPLER_2D]: 'uniform1i',\r\n\t[gl.INT_SAMPLER_2D]: 'uniform1i',\r\n\t[gl.UNSIGNED_INT_SAMPLER_2D]: 'uniform1i',\t\r\n}","export default `#version 300 es\r\n\r\nprecision highp float;\r\nprecision highp int;\r\n\r\nuniform highp ivec2 bl_Size;\r\n\r\nin vec2 bl_UV;\r\n\r\nhighp uint bl_Id() {\r\n\thighp ivec2 uv = ivec2(bl_UV * vec2(bl_Size));\r\n\treturn uint(uv.x + uv.y * bl_Size.x);\r\n}`","import { device, gl, quadVAO } from './WebGL/Context'\r\nimport { Program } from './WebGL/Program'\r\nimport { Buffer } from './Buffer'\r\nimport fragTemplate from './shaders/template.frag'\r\n\r\n/**\r\n * Inputs and outputs have to be defined beforehand. \r\n * Although this means the pipeline is *fixed*, it does allow you\r\n * to swap Buffers before executing the `Kernel`.\r\n *\r\n * Depending on the number of allowed color attachments, a `Kernel`\r\n * may have to split the number of executions in numerous steps.\r\n */\r\n\r\nexport class Kernel {\r\n\tconstructor(io, source) {\r\n\t\tthis.inputs = io.in || io.input || io.inputs || {}\r\n\t\tthis.outputs = io.out || io.output || io.outputs\r\n\r\n\t\tif (!this.outputs || !Object.values(this.outputs).length) {\r\n\t\t\tthrow new Error(`At least 1 output is required.`)\r\n\t\t}\r\n\r\n\r\n\t\t//\r\n\t\t// Check for conflicts.\r\n\t\tfor (const output of Object.keys(this.outputs)) {\r\n\t\t\tfor (const input of Object.keys(this.inputs)) {\r\n\t\t\t\tif (input === output) {\r\n\t\t\t\t\tthrow new Error(`Conflicting input/output variable name: ${input}.`)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t//\r\n\t\t// Compare maximum input variabes allowed by the device.\r\n\t\tlet inputCount = Object.values(this.inputs).length\r\n\t\tif (inputCount > device.maxTextureUnits) {\r\n\t\t\tthrow new Error(`Maximum number of inputs exceeded. Allowed: ${device.maxTextureUnits}, given: ${inputCount}.`)\r\n\t\t}\r\n\r\n\r\n\t\t//\r\n\t\t// Split the task in multiple programs based on the maximum number of outputs.\r\n\t\tconst maxOutputs = device.maxColorAttachments\r\n\t\tconst outputNames = Object.keys(this.outputs)\r\n\t\tconst outputGroupCount = Math.ceil(outputNames.length / maxOutputs)\r\n\t\tlet outputDescriptors = []\r\n\t\t\r\n\t\tlet groupStartIndex = 0\r\n\t\tfor (let a = 0; a < outputGroupCount; a++) {\r\n\t\t\tlet descriptors = {}\r\n\t\t\tfor (const [i, name] of outputNames.entries()) {\r\n\t\t\t\tconst { outputType, precision } = this.outputs[name].formatInfo\r\n\t\t\t\tdescriptors[name] = { outputType, precision }\r\n\r\n\t\t\t\tif (i >= groupStartIndex && i < groupStartIndex + maxOutputs) {\r\n\t\t\t\t\tdescriptors[name].location = i - groupStartIndex\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\toutputDescriptors.push(descriptors)\r\n\t\t\tgroupStartIndex += maxOutputs\r\n\t\t}\r\n\r\n\t\t// Create the set of programs.\r\n\t\tthis.steps = new Set(outputDescriptors.map((descriptors) => {\r\n\t\t\tconst shaderSource = prepareFragmentShader(this.inputs, descriptors, source)\r\n\t\t\tlet program = new Program(shaderSource)\r\n\r\n\t\t\tlet out = []\r\n\t\t\tfor (const [name, descriptor] of Object.entries(descriptors)) {\r\n\t\t\t\tif (descriptor.location !== undefined) {\r\n\t\t\t\t\tout.push(name)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn { out, program }\r\n\t\t}))\r\n\t}\r\n\r\n\tdelete() {\r\n\t\tthis.steps.forEach((obj) => {\r\n\t\t\tobj.program.delete()\r\n\t\t})\r\n\t\tthis.steps.clear()\r\n\r\n\t\tdelete this.inputs\r\n\t\tdelete this.outputs\r\n\t\tdelete this.steps\r\n\t}\r\n\r\n\texec(uniforms = {}) {\r\n\t\t// Check dimensions.\r\n\t\tlet size = []\r\n\t\tfor (const output of Object.values(this.outputs)) {\r\n\t\t\tconst dimensions = [...output.dimensions]\r\n\t\t\tif (!size.length) {\r\n\t\t\t\tsize = dimensions\r\n\t\t\t}\r\n\t\t\telse if (size[0] != dimensions[0] || size[1] != dimensions[1]) {\r\n\t\t\t\tthrow new Error('Outputs require consistent sizes.')\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//\r\n\t\t// Prepare Framebuffer.\r\n\t\tlet fbo = gl.createFramebuffer()\r\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\r\n\r\n\t\t//\r\n\t\t// Run every step.\r\n\t\tfor (const step of this.steps) {\r\n\t\t\t// Output textures.\r\n\t\t\tfor (const [index, name] of step.out.entries()) {\r\n\t\t\t\tconst texture = this.outputs[name]._getWritable(true)\r\n\t\t\t\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + index, gl.TEXTURE_2D, texture.id, 0)\r\n\t\t\t}\r\n\r\n\t\t\tconst { program } = step\r\n\t\t\tgl.useProgram(program.id)\r\n\r\n\t\t\tgl.viewport(0, 0, size[0], size[1])\r\n\r\n\t\t\t// Built-in uniforms.\r\n\t\t\tprogram.setUniform('bl_Size', ...size)\r\n\r\n\t\t\t// User uniforms.\r\n\t\t\tfor (const [uniform, value] of Object.entries(uniforms)) {\r\n\t\t\t\tprogram.setUniform(uniform, value)\r\n\t\t\t}\r\n\r\n\t\t\t// Input textures.\r\n\t\t\tfor (const [index, name] of Object.keys(this.inputs).entries()) {\r\n\t\t\t\tgl.activeTexture(gl.TEXTURE0 + index)\r\n\t\t\t\tconst texture = this.inputs[name]._getReadable(true)\r\n\t\t\t\tgl.bindTexture(gl.TEXTURE_2D, texture.id)\r\n\t\t\t\tprogram.setUniform(name, index)\r\n\t\t\t}\r\n\r\n\t\t\tgl.bindVertexArray(quadVAO)\r\n\t\t\tgl.drawBuffers(step.out.map((_, i) => gl.COLOR_ATTACHMENT0 + i))\r\n\t\t\tgl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)\r\n\t\t\tgl.bindVertexArray(null)\r\n\r\n\t\t\t// Unpacking time. But only for `Buffer`s.\r\n\t\t\tfor (const [index, name] of step.out.entries()) {\r\n\t\t\t\tconst buffer = this.outputs[name]\r\n\t\t\t\tif (buffer instanceof Buffer) {\r\n\t\t\t\t\tconst { bytes, format, type } = buffer.formatInfo\r\n\t\t\t\t\tgl.readBuffer(gl.COLOR_ATTACHMENT0 + index)\r\n\t\t\t\t\tgl.readPixels(0, 0, size[0], size[1], gl[format], gl[type], buffer.data, 0)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, null)\r\n\t\t}\r\n\r\n\t\t// Clean-up all resources.\r\n\t\tconst allBuffers = new Set([...Object.values(this.inputs), ...Object.values(this.outputs)])\r\n\t\tfor (const buffer of allBuffers) {\r\n\t\t\tbuffer._finish()\r\n\t\t}\r\n\r\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\r\n\t\tgl.deleteFramebuffer(fbo)\r\n\t}\r\n}\r\n\r\n\r\nfunction prepareFragmentShader(inputs, outputDescriptors, source) {\r\n\tlet uniforms = Object.entries(inputs).map(([name, buffer]) => {\r\n\t\tconst { inputType, precision } = buffer.formatInfo\r\n\t\treturn `uniform ${precision} ${inputType} ${name};`\r\n\t})\r\n\r\n\tlet outs = Object.entries(outputDescriptors).map(([name, props]) => {\r\n\t\tconst layout = props.location !== undefined ? `layout(location = ${props.location}) out ` : ''\r\n\t\treturn `${layout}${props.precision} ${props.outputType} ${name};`\r\n\t})\r\n\r\n\treturn `${fragTemplate}\r\n\r\n\t\t${uniforms.join('\\n\\r')}\r\n\r\n\t\t${outs.join('\\n\\r')}\r\n\r\n\t\t${source}`\r\n}","export { device, gl as context } from './WebGL/Context'\r\nexport { Buffer } from './Buffer'\r\nexport { DeviceBuffer } from './DeviceBuffer'\r\nexport { Kernel } from './Kernel'\r\n\r\nexport { \r\n\tFLOAT,\r\n\tINT32, INT16, INT8,\r\n\tUINT32, UINT16, UINT8,\r\n\tCLAMP, REPEAT, MIRROR,\r\n} from './common'\r\n\r\nexport const VERSION = {\r\n\tmajor: $_MAJOR,\r\n\tminor: $_MINOR,\r\n\tpatch: $_PATCH,\r\n\ttoString() { return `${this.major}.${this.minor}.${this.patch}` }\r\n}"],"names":["common.FLOAT","common.CLAMP","common.closestDimensions","common.arrayConstructors","common.arrayTypes","common.formatInfo"],"mappings":";;;;;;AAAA;;;AAGA,AAAO,MAAM,EAAE,GAAG,YAAY;CAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;CAC/C,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG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I,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK;EACnE,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;EAC9F,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;EACjE,CAAC,CAAA;;CAEF,OAAO,CAAC,EAAE,YAAY,CAAC;;EAEtB,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;EAExB,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;EAEpB,EAAE,MAAM,CAAC,CAAC;;;AC/KL,MAAM,OAAO,GAAG;CACtB,KAAK,EAAE,CAAO;CACd,KAAK,EAAE,CAAO;CACd,KAAK,EAAE,CAAO;CACd,QAAQ,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/blink.min.js b/dist/blink.min.js index 815a659..38d4cb3 100644 --- a/dist/blink.min.js +++ b/dist/blink.min.js @@ -5,7 +5,7 @@ var _Mathmin=Math.min,_Mathmax=Math.max;(function(b,c){'object'==typeof exports& ${Q.join('\n\r')} - ${O}`}const j=function(){const M=document.createElement('canvas');M.width=M.height=1;let O=M.getContext('webgl2',{alpha:!1,antialias:!1,depth:!1,stencil:!1});if(!O)throw new Error('WebGL 2.0 not supported by the browser.');else if(!(O.floatExt=O.getExtension('EXT_color_buffer_float')))throw new Error('EXT_color_buffer_float not supported.');return O.pixelStorei(O.PACK_ALIGNMENT,1),O.pixelStorei(O.UNPACK_ALIGNMENT,1),O}(),k=function(){let M={glslVersion:j.getParameter(j.SHADING_LANGUAGE_VERSION),maxColorAttachments:j.getParameter(j.MAX_DRAW_BUFFERS),maxTextureSize:j.getParameter(j.MAX_TEXTURE_SIZE),maxTextureUnits:j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),renderer:j.getParameter(j.RENDERER),vendor:j.getParameter(j.VENDOR)};const N=j.getExtension('WEBGL_debug_renderer_info');return N&&(M.unmaskedRenderer=j.getParameter(N.UNMASKED_RENDERER_WEBGL),M.unmaskedVendor=j.getParameter(N.UNMASKED_VENDOR_WEBGL)),Object.freeze(M)}(),l=function(){const M=new Float32Array([-1,1,-1,-1,1,1,1,-1]);let N=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N),j.bufferData(j.ARRAY_BUFFER,M,j.STATIC_DRAW),j.bindBuffer(j.ARRAY_BUFFER,null);let O=j.createVertexArray();return j.bindVertexArray(O),j.bindBuffer(j.ARRAY_BUFFER,N),j.enableVertexAttribArray(0),j.vertexAttribPointer(0,2,j.FLOAT,!1,0,0),j.bindVertexArray(null),j.bindBuffer(j.ARRAY_BUFFER,null),O}(),m=(M,N,O,P)=>Object.freeze({name:M,bytes:N,integer:O,unsigned:P}),n=m('float',4,!1,!1),o=m('int32',4,!0,!1),p=m('int16',2,!0,!1),q=m('int8',1,!0,!1),r=m('uint32',4,!0,!0),s=m('uint16',2,!0,!0),t=m('uint8',1,!0,!0),v=33071,y=new Map([[n,Float32Array],[o,Int32Array],[p,Int16Array],[q,Int8Array],[r,Uint32Array],[s,Uint16Array],[t,Uint8Array]]),z=new Map([[Float32Array,n],[Int32Array,o],[Int16Array,p],[Int8Array,q],[Uint32Array,r],[Uint16Array,s],[Uint8Array,t],[Uint8ClampedArray,t]]);class A{constructor(M,N,O,P,Q,R,S,T,U){const V=j.getParameter(j.TEXTURE_BINDING_2D);this.internalFormat=M,this.width=N,this.height=O,this.format=P,this.type=Q,this.alignment=S,this.id=j.createTexture(),j.bindTexture(j.TEXTURE_2D,this.id),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,T||j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,U||j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST),j.texImage2D(j.TEXTURE_2D,0,j[this.internalFormat],N,O,0,j[this.format],j[this.type],R),j.bindTexture(j.TEXTURE_2D,V)}delete(){j.getParameter(j.TEXTURE_BINDING_2D)==this.id&&j.bindTexture(j.TEXTURE_2D,null),j.deleteTexture(this.id),delete this.id}copy(){let M=new A(this.internalFormat,this.width,this.height,this.format,this.type,null,this.alignment);return e(()=>{j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,this.id,0),j.readBuffer(j.COLOR_ATTACHMENT0),j.bindTexture(j.TEXTURE_2D,M.id),j.copyTexSubImage2D(j.TEXTURE_2D,0,0,0,0,0,this.width,this.height,0),j.bindTexture(j.TEXTURE_2D,null)}),M}upload(M){return j.bindTexture(j.TEXTURE_2D,this.id),j.texImage2D(j.TEXTURE_2D,0,j[this.internalFormat],this.width,this.height,0,j[this.format],j[this.type],M),j.bindTexture(j.TEXTURE_2D,this.id),this}read(M){return e(()=>{j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,this.id,0),j.readBuffer(j.COLOR_ATTACHMENT0),j.readPixels(0,0,this.width,this.height,j[this.format],j[this.type],M,0)}),!0}}let B=new WeakMap,C=new WeakMap;class D{constructor({alloc:M,data:N,type:O=n,vector:P=1,wrap:Q=v}){this.vector=_Mathmin(_Mathmax(P,1),4),3==this.vector&&(console.warn('Vector size of 3 not supported. Choosing vector size 4.'),this.vector=4);let R=M||N.length;this.dimensions=d(R/this.vector),this.wrap=Array.isArray(Q)?Q:[Q,Q];const S=k.maxTextureSize**2;if(_Mathmax(...this.dimensions)>S)throw new Error('Buffer size exceeds device limit.');if(null!=M){const T=y.get(O);this.data=new T(R)}else this.data=N instanceof Uint8ClampedArray?new Uint8Array(N.buffer):N}delete(){delete this.data,this._finish()}copy(){return new D({data:new this.data.constructor(this.data),vector:this.vector})}get formatInfo(){for(const[M,N]of z)if(this.data instanceof M)return c(N,this.vector);return null}_getReadable(M=!1){if(!B.has(this)&&M){const N=f(this,this.data);B.set(this,N)}return B.get(this)}_getWritable(M=!1){if(!C.has(this)&&M){const N=f(this,this.data);C.set(this,N)}return C.get(this)}_finish(){let M=this._getReadable();M&&(M.delete(),B.delete(this));let N=this._getWritable();N&&(N.delete(),C.delete(this))}}class E{constructor({alloc:M,data:N,type:O=n,vector:P=1,wrap:Q=v}){this.vector=_Mathmin(_Mathmax(P,1),4),3==this.vector&&(console.warn('Vector size of 3 not supported. Choosing vector size 4.'),this.vector=4),this.size=M||N.length,this.dimensions=d(this.size/this.vector),this.wrap=Array.isArray(Q)?Q:[Q,Q];const R=k.maxTextureSize**2;if(_Mathmax(...this.dimensions)>R)throw new Error('Buffer size exceeds device limit.');let S=O;if(N)for(const[U,V]of z)if(N instanceof U){S=V;break}this.type=S;let T=this._getReadable(!0);N&&(N.constructor==Uint8ClampedArray&&(N=new Uint8Array(N.buffer)),T.upload(N))}delete(){B.has(this)&&(B.get(this).delete(),B.delete(this))}copy(){let M=this._readable.copy(),N=new E({alloc:this.size,type:this.type,vector:this.vector});return N._readable.delete(),N._readable=M,N}toDevice(M){this._getReadable().upload(M)}toHost(M){if(!M){const O=y.get(this.type);M=new O(this.size)}let N=M;return M instanceof Uint8ClampedArray&&(N=new Uint8Array(M.buffer)),this._getReadable().read(N),M}get formatInfo(){return c(this.type,this.vector)}_getReadable(M=!1){if(!B.has(this)&&M){const{bytes:N,internalFormat:O,format:P,type:Q}=this.formatInfo,[R,S]=this.dimensions;B.set(this,new A(O,R,S,P,Q,null,N,...this.wrap))}return B.get(this)}_getWritable(M=!1){return!C.has(this)&&M&&C.set(this,this._getReadable(!0).copy()),C.get(this)}_finish(){this._getReadable().delete(),B.set(this,this._getWritable()),C.delete(this)}}var F=`#version 300 es + ${O}`}const j=function(){const M=document.createElement('canvas');M.width=M.height=1;let O=M.getContext('webgl2',{alpha:!1,antialias:!1,depth:!1,stencil:!1});if(!O)throw new Error('WebGL 2.0 not supported by the browser.');else if(!(O.floatExt=O.getExtension('EXT_color_buffer_float')))throw new Error('EXT_color_buffer_float not supported.');return O.pixelStorei(O.PACK_ALIGNMENT,1),O.pixelStorei(O.UNPACK_ALIGNMENT,1),O}(),k=function(){let M={glslVersion:j.getParameter(j.SHADING_LANGUAGE_VERSION),maxColorAttachments:j.getParameter(j.MAX_DRAW_BUFFERS),maxTextureSize:j.getParameter(j.MAX_TEXTURE_SIZE),maxTextureUnits:j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),renderer:j.getParameter(j.RENDERER),vendor:j.getParameter(j.VENDOR)};const N=j.getExtension('WEBGL_debug_renderer_info');return N&&(M.unmaskedRenderer=j.getParameter(N.UNMASKED_RENDERER_WEBGL),M.unmaskedVendor=j.getParameter(N.UNMASKED_VENDOR_WEBGL)),Object.freeze(M)}(),l=function(){const M=new Float32Array([-1,1,-1,-1,1,1,1,-1]);let N=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N),j.bufferData(j.ARRAY_BUFFER,M,j.STATIC_DRAW),j.bindBuffer(j.ARRAY_BUFFER,null);let O=j.createVertexArray();return j.bindVertexArray(O),j.bindBuffer(j.ARRAY_BUFFER,N),j.enableVertexAttribArray(0),j.vertexAttribPointer(0,2,j.FLOAT,!1,0,0),j.bindVertexArray(null),j.bindBuffer(j.ARRAY_BUFFER,null),O}(),m=(M,N,O,P)=>Object.freeze({name:M,bytes:N,integer:O,unsigned:P}),n=m('float',4,!1,!1),o=m('int32',4,!0,!1),p=m('int16',2,!0,!1),q=m('int8',1,!0,!1),r=m('uint32',4,!0,!0),s=m('uint16',2,!0,!0),t=m('uint8',1,!0,!0),v=33071,y=new Map([[n,Float32Array],[o,Int32Array],[p,Int16Array],[q,Int8Array],[r,Uint32Array],[s,Uint16Array],[t,Uint8Array]]),z=new Map([[Float32Array,n],[Int32Array,o],[Int16Array,p],[Int8Array,q],[Uint32Array,r],[Uint16Array,s],[Uint8Array,t],[Uint8ClampedArray,t]]);class A{constructor(M,N,O,P,Q,R,S,T,U){const V=j.getParameter(j.TEXTURE_BINDING_2D);this.internalFormat=M,this.width=N,this.height=O,this.format=P,this.type=Q,this.alignment=S,this.id=j.createTexture(),j.bindTexture(j.TEXTURE_2D,this.id),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,T||j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,U||j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST),j.texImage2D(j.TEXTURE_2D,0,j[this.internalFormat],N,O,0,j[this.format],j[this.type],R),j.bindTexture(j.TEXTURE_2D,V)}delete(){j.getParameter(j.TEXTURE_BINDING_2D)==this.id&&j.bindTexture(j.TEXTURE_2D,null),j.deleteTexture(this.id),delete this.id}copy(){let M=new A(this.internalFormat,this.width,this.height,this.format,this.type,null,this.alignment);return e(()=>{j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,this.id,0),j.readBuffer(j.COLOR_ATTACHMENT0),j.bindTexture(j.TEXTURE_2D,M.id),j.copyTexSubImage2D(j.TEXTURE_2D,0,0,0,0,0,this.width,this.height,0),j.bindTexture(j.TEXTURE_2D,null)}),M}upload(M){return j.bindTexture(j.TEXTURE_2D,this.id),j.texImage2D(j.TEXTURE_2D,0,j[this.internalFormat],this.width,this.height,0,j[this.format],j[this.type],M),j.bindTexture(j.TEXTURE_2D,null),this}read(M){return e(()=>{j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,this.id,0),j.readBuffer(j.COLOR_ATTACHMENT0),j.readPixels(0,0,this.width,this.height,j[this.format],j[this.type],M,0)}),!0}}let B=new WeakMap,C=new WeakMap;class D{constructor({alloc:M,data:N,type:O=n,vector:P=1,wrap:Q=v}){this.vector=_Mathmin(_Mathmax(P,1),4),3==this.vector&&(console.warn('Vector size of 3 not supported. Choosing vector size 4.'),this.vector=4);let R=M||N.length;this.dimensions=d(R/this.vector),this.wrap=Array.isArray(Q)?Q:[Q,Q];const S=k.maxTextureSize**2;if(_Mathmax(...this.dimensions)>S)throw new Error('Buffer size exceeds device limit.');if(null!=M){const T=y.get(O);this.data=new T(R)}else this.data=N instanceof Uint8ClampedArray?new Uint8Array(N.buffer):N}delete(){delete this.data,this._finish()}copy(){return new D({data:new this.data.constructor(this.data),vector:this.vector})}get formatInfo(){for(const[M,N]of z)if(this.data instanceof M)return c(N,this.vector);return null}_getReadable(M=!1){if(!B.has(this)&&M){const N=f(this,this.data);B.set(this,N)}return B.get(this)}_getWritable(M=!1){if(!C.has(this)&&M){const N=f(this,this.data);C.set(this,N)}return C.get(this)}_finish(){let M=this._getReadable();M&&(M.delete(),B.delete(this));let N=this._getWritable();N&&(N.delete(),C.delete(this))}}class E{constructor({alloc:M,data:N,type:O=n,vector:P=1,wrap:Q=v}){this.vector=_Mathmin(_Mathmax(P,1),4),3==this.vector&&(console.warn('Vector size of 3 not supported. Choosing vector size 4.'),this.vector=4),this.size=M||N.length,this.dimensions=d(this.size/this.vector),this.wrap=Array.isArray(Q)?Q:[Q,Q];const R=k.maxTextureSize**2;if(_Mathmax(...this.dimensions)>R)throw new Error('Buffer size exceeds device limit.');let S=O;if(N)for(const[U,V]of z)if(N instanceof U){S=V;break}this.type=S;let T=this._getReadable(!0);N&&(N.constructor==Uint8ClampedArray&&(N=new Uint8Array(N.buffer)),T.upload(N))}delete(){B.has(this)&&(B.get(this).delete(),B.delete(this))}copy(){let M=this._readable.copy(),N=new E({alloc:this.size,type:this.type,vector:this.vector});return N._readable.delete(),N._readable=M,N}toDevice(M){this._getReadable().upload(M)}toHost(M){if(!M){const O=y.get(this.type);M=new O(this.size)}let N=M;return M instanceof Uint8ClampedArray&&(N=new Uint8Array(M.buffer)),this._getReadable().read(N),M}get formatInfo(){return c(this.type,this.vector)}_getReadable(M=!1){if(!B.has(this)&&M){const{bytes:N,internalFormat:O,format:P,type:Q}=this.formatInfo,[R,S]=this.dimensions;B.set(this,new A(O,R,S,P,Q,null,N,...this.wrap))}return B.get(this)}_getWritable(M=!1){return!C.has(this)&&M&&C.set(this,this._getReadable(!0).copy()),C.get(this)}_finish(){let M=this._getWritable();if(M){let N=this._getReadable();N&&N.delete(),B.set(this,M),C.delete(this)}}}var F=`#version 300 es precision highp float; @@ -27,4 +27,4 @@ in vec2 bl_UV; highp uint bl_Id() { highp ivec2 uv = ivec2(bl_UV * vec2(bl_Size)); return uint(uv.x + uv.y * bl_Size.x); -}`;const L={major:0,minor:2,patch:3,toString(){return`${this.major}.${this.minor}.${this.patch}`}};b.VERSION=L,b.device=k,b.context=j,b.Buffer=D,b.DeviceBuffer=E,b.Kernel=class{constructor(M,N){if(this.inputs=M.in||M.input||M.inputs||{},this.outputs=M.out||M.output||M.outputs,!this.outputs||!Object.values(this.outputs).length)throw new Error(`At least 1 output is required.`);for(const U of Object.keys(this.outputs))for(const V of Object.keys(this.inputs))if(V===U)throw new Error(`Conflicting input/output variable name: ${V}.`);let O=Object.values(this.inputs).length;if(O>k.maxTextureUnits)throw new Error(`Maximum number of inputs exceeded. Allowed: ${k.maxTextureUnits}, given: ${O}.`);const P=k.maxColorAttachments,Q=Object.keys(this.outputs),R=Math.ceil(Q.length/P);let S=[],T=0;for(let V,U=0;U=T&&W{const V=h(this.inputs,U,N);let W=new H(V),X=[];for(const[Y,Z]of Object.entries(U))void 0!==Z.location&&X.push(Y);return{out:X,program:W}}))}delete(){this.steps.forEach((M)=>{M.program.delete()}),this.steps.clear(),delete this.inputs,delete this.outputs,delete this.steps}exec(M={}){let N=[];for(const Q of Object.values(this.outputs)){const R=[...Q.dimensions];if(!N.length)N=R;else if(N[0]!=R[0]||N[1]!=R[1])throw new Error('Outputs require consistent sizes.')}let O=j.createFramebuffer();j.bindFramebuffer(j.FRAMEBUFFER,O);for(const Q of this.steps){for(const[S,T]of Q.out.entries()){const U=this.outputs[T]._getWritable(!0);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0+S,j.TEXTURE_2D,U.id,0)}const{program:R}=Q;j.useProgram(R.id),j.viewport(0,0,N[0],N[1]),R.setUniform('bl_Size',...N);for(const[S,T]of Object.entries(M))R.setUniform(S,T);for(const[S,T]of Object.keys(this.inputs).entries()){j.activeTexture(j.TEXTURE0+S);const U=this.inputs[T]._getReadable(!0);j.bindTexture(j.TEXTURE_2D,U.id),R.setUniform(T,S)}j.bindVertexArray(l),j.drawBuffers(Q.out.map((S,T)=>j.COLOR_ATTACHMENT0+T)),j.drawArrays(j.TRIANGLE_STRIP,0,4),j.bindVertexArray(null);for(const[S,T]of Q.out.entries()){const U=this.outputs[T];if(U instanceof D){const{bytes:V,format:W,type:X}=U.formatInfo;j.readBuffer(j.COLOR_ATTACHMENT0+S),j.readPixels(0,0,N[0],N[1],j[W],j[X],U.data,0)}}j.bindTexture(j.TEXTURE_2D,null)}const P=new Set([...Object.values(this.inputs),...Object.values(this.outputs)]);for(const Q of P)Q._finish();j.bindFramebuffer(j.FRAMEBUFFER,null),j.deleteFramebuffer(O)}},b.FLOAT=n,b.INT32=o,b.INT16=p,b.INT8=q,b.UINT32=r,b.UINT16=s,b.UINT8=t,b.CLAMP=v,b.REPEAT=10497,b.MIRROR=33648,Object.defineProperty(b,'__esModule',{value:!0})}); +}`;const L={major:0,minor:2,patch:4,toString(){return`${this.major}.${this.minor}.${this.patch}`}};b.VERSION=L,b.device=k,b.context=j,b.Buffer=D,b.DeviceBuffer=E,b.Kernel=class{constructor(M,N){if(this.inputs=M.in||M.input||M.inputs||{},this.outputs=M.out||M.output||M.outputs,!this.outputs||!Object.values(this.outputs).length)throw new Error(`At least 1 output is required.`);for(const U of Object.keys(this.outputs))for(const V of Object.keys(this.inputs))if(V===U)throw new Error(`Conflicting input/output variable name: ${V}.`);let O=Object.values(this.inputs).length;if(O>k.maxTextureUnits)throw new Error(`Maximum number of inputs exceeded. Allowed: ${k.maxTextureUnits}, given: ${O}.`);const P=k.maxColorAttachments,Q=Object.keys(this.outputs),R=Math.ceil(Q.length/P);let S=[],T=0;for(let V,U=0;U=T&&W{const V=h(this.inputs,U,N);let W=new H(V),X=[];for(const[Y,Z]of Object.entries(U))void 0!==Z.location&&X.push(Y);return{out:X,program:W}}))}delete(){this.steps.forEach((M)=>{M.program.delete()}),this.steps.clear(),delete this.inputs,delete this.outputs,delete this.steps}exec(M={}){let N=[];for(const Q of Object.values(this.outputs)){const R=[...Q.dimensions];if(!N.length)N=R;else if(N[0]!=R[0]||N[1]!=R[1])throw new Error('Outputs require consistent sizes.')}let O=j.createFramebuffer();j.bindFramebuffer(j.FRAMEBUFFER,O);for(const Q of this.steps){for(const[S,T]of Q.out.entries()){const U=this.outputs[T]._getWritable(!0);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0+S,j.TEXTURE_2D,U.id,0)}const{program:R}=Q;j.useProgram(R.id),j.viewport(0,0,N[0],N[1]),R.setUniform('bl_Size',...N);for(const[S,T]of Object.entries(M))R.setUniform(S,T);for(const[S,T]of Object.keys(this.inputs).entries()){j.activeTexture(j.TEXTURE0+S);const U=this.inputs[T]._getReadable(!0);j.bindTexture(j.TEXTURE_2D,U.id),R.setUniform(T,S)}j.bindVertexArray(l),j.drawBuffers(Q.out.map((S,T)=>j.COLOR_ATTACHMENT0+T)),j.drawArrays(j.TRIANGLE_STRIP,0,4),j.bindVertexArray(null);for(const[S,T]of Q.out.entries()){const U=this.outputs[T];if(U instanceof D){const{bytes:V,format:W,type:X}=U.formatInfo;j.readBuffer(j.COLOR_ATTACHMENT0+S),j.readPixels(0,0,N[0],N[1],j[W],j[X],U.data,0)}}j.bindTexture(j.TEXTURE_2D,null)}const P=new Set([...Object.values(this.inputs),...Object.values(this.outputs)]);for(const Q of P)Q._finish();j.bindFramebuffer(j.FRAMEBUFFER,null),j.deleteFramebuffer(O)}},b.FLOAT=n,b.INT32=o,b.INT16=p,b.INT8=q,b.UINT32=r,b.UINT16=s,b.UINT8=t,b.CLAMP=v,b.REPEAT=10497,b.MIRROR=33648,Object.defineProperty(b,'__esModule',{value:!0})});