Skip to content

Commit

Permalink
fix: Correct wording for validateSettings errors and use Error inst…
Browse files Browse the repository at this point in the history
…ance in CPU Kernel

fix: Add missing precision for `sampler2DArray` in WebGL2 fragment shader
fix: Add validateSettings in typings file
fix: offscreen-canvas.js broken test from bin to dist move
fix: Fix typings Kernel hierarchy
fix: Bump and build
  • Loading branch information
robertleeplummerjr committed Jul 2, 2019
1 parent 8aac6ab commit f46a50d
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 99 deletions.
37 changes: 19 additions & 18 deletions dist/gpu-browser-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.18
* @date Sat Jun 29 2019 10:06:59 GMT-0400 (Eastern Daylight Time)
* @version 2.0.0-rc.19
* @date Tue Jul 02 2019 12:17:44 GMT-0400 (Eastern Daylight Time)
*
* @license MIT
* The MIT License
Expand Down Expand Up @@ -1223,19 +1223,19 @@ class CPUKernel extends Kernel {
return [];
}

validateSettings() {
validateSettings(args) {
if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
throw 'Auto dimensions only supported for kernels with only one input';
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw 'Auto dimensions not supported for input type: ' + argType;
throw new Error('Auto output not supported for input type: ' + argType);
}
}

Expand Down Expand Up @@ -1270,7 +1270,7 @@ class CPUKernel extends Kernel {
build() {
this.setupConstants();
this.setupArguments(arguments);
this.validateSettings();
this.validateSettings(arguments);
this.translateSource();

if (this.graphical) {
Expand Down Expand Up @@ -8462,7 +8462,7 @@ class WebGLKernel extends GLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand Down Expand Up @@ -8493,15 +8493,15 @@ class WebGLKernel extends GLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw new Error('Auto output not supported for input type: ' + argType);
}
Expand Down Expand Up @@ -8683,7 +8683,7 @@ class WebGLKernel extends GLKernel {

build() {
this.initExtensions();
this.validateSettings();
this.validateSettings(arguments);
this.setupConstants(arguments);
if (this.fallbackRequested) return;
this.setupArguments(arguments);
Expand Down Expand Up @@ -9611,6 +9611,7 @@ __HEADER__;
precision highp float;
precision highp int;
precision highp sampler2D;
precision highp sampler2DArray;
const int LOOP_MAX = __LOOP_MAX__;
Expand Down Expand Up @@ -10619,7 +10620,7 @@ class WebGL2Kernel extends WebGLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand All @@ -10644,11 +10645,11 @@ class WebGL2Kernel extends WebGLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
switch (argType) {
case 'Array':
this.output = utils.getDimensions(argType);
Expand All @@ -10659,7 +10660,7 @@ class WebGL2Kernel extends WebGLKernel {
case 'ArrayTexture(2)':
case 'ArrayTexture(3)':
case 'ArrayTexture(4)':
this.output = arguments[0].output;
this.output = args[0].output;
break;
default:
throw new Error('Auto output not supported for input type: ' + argType);
Expand Down
41 changes: 21 additions & 20 deletions dist/gpu-browser-core.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.18
* @date Sat Jun 29 2019 10:07:01 GMT-0400 (Eastern Daylight Time)
* @version 2.0.0-rc.19
* @date Tue Jul 02 2019 12:17:46 GMT-0400 (Eastern Daylight Time)
*
* @license MIT
* The MIT License
Expand All @@ -17,8 +17,8 @@
*
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.18
* @date Sat Jun 29 2019 10:06:59 GMT-0400 (Eastern Daylight Time)
* @version 2.0.0-rc.19
* @date Tue Jul 02 2019 12:17:44 GMT-0400 (Eastern Daylight Time)
*
* @license MIT
* The MIT License
Expand Down Expand Up @@ -1236,19 +1236,19 @@ class CPUKernel extends Kernel {
return [];
}

validateSettings() {
validateSettings(args) {
if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
throw 'Auto dimensions only supported for kernels with only one input';
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw 'Auto dimensions not supported for input type: ' + argType;
throw new Error('Auto output not supported for input type: ' + argType);
}
}

Expand Down Expand Up @@ -1283,7 +1283,7 @@ class CPUKernel extends Kernel {
build() {
this.setupConstants();
this.setupArguments(arguments);
this.validateSettings();
this.validateSettings(arguments);
this.translateSource();

if (this.graphical) {
Expand Down Expand Up @@ -8475,7 +8475,7 @@ class WebGLKernel extends GLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand Down Expand Up @@ -8506,15 +8506,15 @@ class WebGLKernel extends GLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw new Error('Auto output not supported for input type: ' + argType);
}
Expand Down Expand Up @@ -8696,7 +8696,7 @@ class WebGLKernel extends GLKernel {

build() {
this.initExtensions();
this.validateSettings();
this.validateSettings(arguments);
this.setupConstants(arguments);
if (this.fallbackRequested) return;
this.setupArguments(arguments);
Expand Down Expand Up @@ -9624,6 +9624,7 @@ __HEADER__;
precision highp float;
precision highp int;
precision highp sampler2D;
precision highp sampler2DArray;
const int LOOP_MAX = __LOOP_MAX__;
Expand Down Expand Up @@ -10632,7 +10633,7 @@ class WebGL2Kernel extends WebGLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand All @@ -10657,11 +10658,11 @@ class WebGL2Kernel extends WebGLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
switch (argType) {
case 'Array':
this.output = utils.getDimensions(argType);
Expand All @@ -10672,7 +10673,7 @@ class WebGL2Kernel extends WebGLKernel {
case 'ArrayTexture(2)':
case 'ArrayTexture(3)':
case 'ArrayTexture(4)':
this.output = arguments[0].output;
this.output = args[0].output;
break;
default:
throw new Error('Auto output not supported for input type: ' + argType);
Expand Down
37 changes: 19 additions & 18 deletions dist/gpu-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.18
* @date Sat Jun 29 2019 10:06:59 GMT-0400 (Eastern Daylight Time)
* @version 2.0.0-rc.19
* @date Tue Jul 02 2019 12:17:44 GMT-0400 (Eastern Daylight Time)
*
* @license MIT
* The MIT License
Expand Down Expand Up @@ -5987,19 +5987,19 @@ class CPUKernel extends Kernel {
return [];
}

validateSettings() {
validateSettings(args) {
if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
throw 'Auto dimensions only supported for kernels with only one input';
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw 'Auto dimensions not supported for input type: ' + argType;
throw new Error('Auto output not supported for input type: ' + argType);
}
}

Expand Down Expand Up @@ -6034,7 +6034,7 @@ class CPUKernel extends Kernel {
build() {
this.setupConstants();
this.setupArguments(arguments);
this.validateSettings();
this.validateSettings(arguments);
this.translateSource();

if (this.graphical) {
Expand Down Expand Up @@ -13226,7 +13226,7 @@ class WebGLKernel extends GLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand Down Expand Up @@ -13257,15 +13257,15 @@ class WebGLKernel extends GLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
if (argType === 'Array') {
this.output = utils.getDimensions(argType);
} else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') {
this.output = arguments[0].output;
this.output = args[0].output;
} else {
throw new Error('Auto output not supported for input type: ' + argType);
}
Expand Down Expand Up @@ -13447,7 +13447,7 @@ class WebGLKernel extends GLKernel {

build() {
this.initExtensions();
this.validateSettings();
this.validateSettings(arguments);
this.setupConstants(arguments);
if (this.fallbackRequested) return;
this.setupArguments(arguments);
Expand Down Expand Up @@ -14375,6 +14375,7 @@ __HEADER__;
precision highp float;
precision highp int;
precision highp sampler2D;
precision highp sampler2DArray;

const int LOOP_MAX = __LOOP_MAX__;

Expand Down Expand Up @@ -15383,7 +15384,7 @@ class WebGL2Kernel extends WebGLKernel {
};
}

validateSettings() {
validateSettings(args) {
if (!this.validate) {
this.texSize = utils.getKernelTextureSize({
optimizeFloatMemory: this.optimizeFloatMemory,
Expand All @@ -15408,11 +15409,11 @@ class WebGL2Kernel extends WebGLKernel {
this.checkOutput();

if (!this.output || this.output.length === 0) {
if (arguments.length !== 1) {
if (args.length !== 1) {
throw new Error('Auto output only supported for kernels with only one input');
}

const argType = utils.getVariableType(arguments[0], this.strictIntegers);
const argType = utils.getVariableType(args[0], this.strictIntegers);
switch (argType) {
case 'Array':
this.output = utils.getDimensions(argType);
Expand All @@ -15423,7 +15424,7 @@ class WebGL2Kernel extends WebGLKernel {
case 'ArrayTexture(2)':
case 'ArrayTexture(3)':
case 'ArrayTexture(4)':
this.output = arguments[0].output;
this.output = args[0].output;
break;
default:
throw new Error('Auto output not supported for input type: ' + argType);
Expand Down
Loading

0 comments on commit f46a50d

Please sign in to comment.