mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
broken
This commit is contained in:
parent
1b0d66682e
commit
8201825f2e
@ -5,12 +5,12 @@
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 1.10.4
|
||||
* @date Sun Nov 18 2018 15:47:22 GMT-0500 (EST)
|
||||
* @date Sun Feb 10 2019 20:40:25 GMT-0600 (Central Standard Time)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2018 gpu.js Team
|
||||
* Copyright (c) 2019 gpu.js Team
|
||||
*/
|
||||
"use strict";(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
4
bin/gpu-core.min.js
vendored
4
bin/gpu-core.min.js
vendored
@ -5,11 +5,11 @@
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 1.10.4
|
||||
* @date Sun Nov 18 2018 15:47:22 GMT-0500 (EST)
|
||||
* @date Sun Feb 10 2019 20:40:25 GMT-0600 (Central Standard Time)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2018 gpu.js Team
|
||||
* 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]);
|
||||
2144
bin/gpu.js
2144
bin/gpu.js
File diff suppressed because it is too large
Load Diff
18
bin/gpu.min.js
vendored
18
bin/gpu.min.js
vendored
File diff suppressed because one or more lines are too long
56
dist/backend/kernel-base.js
vendored
56
dist/backend/kernel-base.js
vendored
@ -11,13 +11,13 @@ module.exports = function () {
|
||||
|
||||
/**
|
||||
* @constructor KernelBase
|
||||
*
|
||||
* @desc Implements the base class for Kernels, and is used as a
|
||||
*
|
||||
* @desc Implements the base class for Kernels, and is used as a
|
||||
* parent class for all Kernel implementations.
|
||||
*
|
||||
* This contains the basic methods needed by all Kernel implementations,
|
||||
* This contains the basic methods needed by all Kernel implementations,
|
||||
* like setDimensions, addSubKernel, etc.
|
||||
*
|
||||
*
|
||||
* @prop {Array} paramNames - Name of the parameters of the kernel function
|
||||
* @prop {String} fnString - Kernel function as a String
|
||||
* @prop {Array} dimensions - Dimensions of the kernel function, this.thread.x, etc.
|
||||
@ -64,6 +64,8 @@ module.exports = function () {
|
||||
this.paramSizes = null;
|
||||
this.constantTypes = null;
|
||||
this.fixIntegerDivisionAccuracy = null;
|
||||
this.constrainStart = null;
|
||||
this.constrainEnd = null;
|
||||
|
||||
for (var p in settings) {
|
||||
if (!settings.hasOwnProperty(p) || !this.hasOwnProperty(p)) continue;
|
||||
@ -198,6 +200,42 @@ module.exports = function () {
|
||||
/**
|
||||
* @memberOf KernelBase#
|
||||
* @function
|
||||
* @name constrain
|
||||
*
|
||||
* @desc constrain kernel to operate on subset quad of matrix
|
||||
*
|
||||
* @param {Array} start - [x, y, z]
|
||||
* @param {Array} end - [x, y, z]
|
||||
*
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'constrain',
|
||||
value: function constrain(start, end) {
|
||||
this.constrainStart = start || null;
|
||||
this.constrainEnd = end || null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberOf KernelBase#
|
||||
* @function
|
||||
* @name deconstrain
|
||||
*
|
||||
* @desc remove constraint on kernelin order to operate on entire matrix
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'deconstrain',
|
||||
value: function deconstrain() {
|
||||
this.constrainStart = null;
|
||||
this.constrainEnd = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberOf KernelBase#
|
||||
* @function
|
||||
* @name setLoopMaxIterations
|
||||
*
|
||||
* @desc Set the maximum number of loop iterations
|
||||
@ -220,7 +258,7 @@ module.exports = function () {
|
||||
*
|
||||
* @desc Fix division by factor of 3 FP accuracy bug
|
||||
*
|
||||
* @param {Boolean} fix - should fix
|
||||
* @param {Boolean} fix - should fix
|
||||
*
|
||||
*/
|
||||
|
||||
@ -318,7 +356,7 @@ module.exports = function () {
|
||||
* @name setCanvas
|
||||
*
|
||||
* @desc Bind the canvas to kernel
|
||||
*
|
||||
*
|
||||
* @param {Canvas} canvas - Canvas to bind
|
||||
*
|
||||
*/
|
||||
@ -336,7 +374,7 @@ module.exports = function () {
|
||||
* @name setCanvas
|
||||
*
|
||||
* @desc Bind the webGL instance to kernel
|
||||
*
|
||||
*
|
||||
* @param {Canvas} webGL - webGL instance to bind
|
||||
*
|
||||
*/
|
||||
@ -412,7 +450,7 @@ module.exports = function () {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @memberOf KernelBase#
|
||||
* @function
|
||||
* @name addSubKernel
|
||||
@ -436,7 +474,7 @@ module.exports = function () {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @memberOf KernelBase#
|
||||
* @function
|
||||
* @name addSubKernelProperty
|
||||
|
||||
44
dist/backend/web-gl/kernel.js
vendored
44
dist/backend/web-gl/kernel.js
vendored
@ -343,6 +343,50 @@ module.exports = function (_KernelBase) {
|
||||
this._addArgument(arguments[texIndex], paramTypes[texIndex], paramNames[texIndex]);
|
||||
}
|
||||
|
||||
if (this.constrainStart || this.constrainEnd) {
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer);
|
||||
|
||||
if (this.constrainStart) {} else {}
|
||||
if (this.constrainEnd) {} else {}
|
||||
var vertices = [-0.5, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0];
|
||||
|
||||
var indices = [3, 2, 1, 3, 1, 0];
|
||||
|
||||
// Create an empty buffer object to store vertex buffer
|
||||
var vertex_buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
|
||||
// Create an empty buffer object to store Index buffer
|
||||
var Index_Buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
||||
|
||||
// original
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
||||
this._setupOutputTexture();
|
||||
return this.renderOutput(this.outputTexture);
|
||||
}
|
||||
|
||||
if (this.graphical) {
|
||||
if (this.outputToTexture) {
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
|
||||
3
dist/backend/web-gl/runner.js
vendored
3
dist/backend/web-gl/runner.js
vendored
@ -19,7 +19,8 @@ module.exports = function (_RunnerBase) {
|
||||
* @constructor WebGLRunner
|
||||
*
|
||||
* @extends RunnerBase
|
||||
* @desc Instantiates a Runner instance for the kernel.
|
||||
|
||||
* @desc Instantiates a Runner instance for the kernel.
|
||||
*
|
||||
* @param {Object} settings - Settings to instantiate properties in RunnerBase, with given values
|
||||
*
|
||||
|
||||
43
dist/backend/web-gl2/kernel.js
vendored
43
dist/backend/web-gl2/kernel.js
vendored
@ -139,6 +139,49 @@ module.exports = function (_WebGLKernel) {
|
||||
this._addArgument(arguments[texIndex], paramTypes[texIndex], paramNames[texIndex]);
|
||||
}
|
||||
|
||||
if (this.constrainStart || this.constrainEnd) {
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer);
|
||||
|
||||
if (this.constrainStart) {} else {}
|
||||
if (this.constrainEnd) {} else {}
|
||||
var vertices = [-0.5, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0];
|
||||
|
||||
var indices = [3, 2, 1, 3, 1, 0];
|
||||
|
||||
// Create an empty buffer object to store vertex buffer
|
||||
var vertex_buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
|
||||
// Create an empty buffer object to store Index buffer
|
||||
var Index_Buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
||||
|
||||
// original
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.graphical) {
|
||||
if (this.outputToTexture) {
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
|
||||
3
dist/backend/web-gl2/runner.js
vendored
3
dist/backend/web-gl2/runner.js
vendored
@ -19,7 +19,8 @@ module.exports = function (_RunnerBase) {
|
||||
* @constructor WebGL2Runner
|
||||
*
|
||||
* @extends RunnerBase
|
||||
* @desc Instantiates a Runner instance for the kernel.
|
||||
|
||||
* @desc Instantiates a Runner instance for the kernel.
|
||||
*
|
||||
* @param {Object} settings - Settings to instantiate properties in RunnerBase, with given values
|
||||
*
|
||||
|
||||
3
dist/core/utils.js
vendored
3
dist/core/utils.js
vendored
@ -657,7 +657,8 @@ var Utils = function (_UtilsCore) {
|
||||
* @param {Array} array - The array to split into chunks
|
||||
* @param {Array} part - elements in one chunk
|
||||
*
|
||||
* @returns {Array} An array of smaller chunks
|
||||
|
||||
* @returns {Array} An array of smaller chunks
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@ -449,4 +449,4 @@ module.exports = class KernelBase {
|
||||
destroy() {
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -31,4 +31,4 @@ module.exports = function kernelRunShortcut(kernel) {
|
||||
shortcut.kernel = kernel;
|
||||
|
||||
return shortcut;
|
||||
};
|
||||
};
|
||||
@ -320,6 +320,61 @@ module.exports = class WebGLKernel extends KernelBase {
|
||||
this._addArgument(arguments[texIndex], paramTypes[texIndex], paramNames[texIndex]);
|
||||
}
|
||||
|
||||
if (this.constrainStart || this.constrainEnd) {
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer);
|
||||
|
||||
if (this.constrainStart) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
if (this.constrainEnd) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
var vertices = [-0.5, 0.5, 0.0, -0.5, -0.5, 0.0,
|
||||
0.5, -0.5, 0.0,
|
||||
0.5, 0.5, 0.0
|
||||
];
|
||||
|
||||
var indices = [3, 2, 1, 3, 1, 0];
|
||||
|
||||
// Create an empty buffer object to store vertex buffer
|
||||
var vertex_buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
|
||||
// Create an empty buffer object to store Index buffer
|
||||
var Index_Buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
||||
|
||||
// original
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
||||
this._setupOutputTexture();
|
||||
return this.renderOutput(this.outputTexture);
|
||||
}
|
||||
|
||||
if (this.graphical) {
|
||||
if (this.outputToTexture) {
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
|
||||
@ -125,7 +125,7 @@ module.exports = class WebGL2Kernel extends WebGLKernel {
|
||||
|
||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||
gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer);
|
||||
|
||||
|
||||
if (this.constrainStart) {
|
||||
|
||||
} else {
|
||||
@ -136,38 +136,36 @@ module.exports = class WebGL2Kernel extends WebGLKernel {
|
||||
} else {
|
||||
|
||||
}
|
||||
var vertices = [
|
||||
-0.5, 0.5, 0.0,
|
||||
-0.5, -0.5, 0.0,
|
||||
0.5, -0.5, 0.0,
|
||||
0.5, 0.5, 0.0
|
||||
var vertices = [-0.5, 0.5, 0.0, -0.5, -0.5, 0.0,
|
||||
0.5, -0.5, 0.0,
|
||||
0.5, 0.5, 0.0
|
||||
];
|
||||
|
||||
indices = [3, 2, 1, 3, 1, 0];
|
||||
var indices = [3, 2, 1, 3, 1, 0];
|
||||
|
||||
// Create an empty buffer object to store vertex buffer
|
||||
var vertex_buffer = gl.createBuffer();
|
||||
// Create an empty buffer object to store vertex buffer
|
||||
var vertex_buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertex_buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
|
||||
// Create an empty buffer object to store Index buffer
|
||||
var Index_Buffer = gl.createBuffer();
|
||||
// Create an empty buffer object to store Index buffer
|
||||
var Index_Buffer = gl.createBuffer();
|
||||
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);
|
||||
// Bind appropriate array buffer to it
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, Index_Buffer);
|
||||
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
||||
// Pass the vertex data to the buffer
|
||||
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW);
|
||||
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
||||
// Unbind the buffer
|
||||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
||||
|
||||
// original
|
||||
|
||||
@ -1047,4 +1045,4 @@ module.exports = class WebGL2Kernel extends WebGLKernel {
|
||||
}
|
||||
return this.compiledVertShaderString = this.constructor.vertShaderString;
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -26,6 +26,7 @@
|
||||
<script src="features/constants-image-array.js"></script>
|
||||
<script src="features/constants-integer.js"></script>
|
||||
<script src="features/constants-texture.js"></script>
|
||||
<script src="features/constrain.js"></script>
|
||||
<script src="features/create-kernel-map.js"></script>
|
||||
<script src="features/demo.js"></script>
|
||||
<script src="features/float-output.js"></script>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
var f = gpu.createKernel(function() {
|
||||
return 255;
|
||||
}, {
|
||||
output : [4, 4, 3]
|
||||
output : [3, 4, 4]
|
||||
});
|
||||
let x = 2;
|
||||
let y = 2;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user