Skip to content

Commit e3d80ea

Browse files
fix: double definitions for arrays when they are integers
fixes #399
1 parent c97c86f commit e3d80ea

File tree

11 files changed

+44
-31
lines changed

11 files changed

+44
-31
lines changed

bin/gpu-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 1.10.2
8-
* @date Thu Nov 01 2018 14:15:00 GMT-0400 (EDT)
7+
* @version 1.10.3
8+
* @date Sun Nov 18 2018 14:07:45 GMT-0500 (EST)
99
*
1010
* @license MIT
1111
* The MIT License

bin/gpu-core.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/gpu.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 1.10.2
8-
* @date Thu Nov 01 2018 14:15:00 GMT-0400 (EDT)
7+
* @version 1.10.3
8+
* @date Sun Nov 18 2018 14:07:45 GMT-0500 (EST)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -4437,7 +4437,7 @@ module.exports = function (_KernelBase) {
44374437
floatOutput: this.floatOutput
44384438
}, paramDim);
44394439

4440-
result.push('uniform sampler2D user_' + paramName, 'ivec2 user_' + paramName + 'Size = vec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'ivec3 user_' + paramName + 'Dim = vec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform int user_' + paramName + 'BitRatio');
4440+
result.push('uniform sampler2D user_' + paramName, 'ivec2 user_' + paramName + 'Size = ivec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'ivec3 user_' + paramName + 'Dim = ivec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform int user_' + paramName + 'BitRatio');
44414441
} else if (paramType === 'Integer') {
44424442
result.push('float user_' + paramName + ' = ' + param + '.0');
44434443
} else if (paramType === 'Float') {
@@ -5565,10 +5565,6 @@ module.exports = function (_WebGLKernel) {
55655565
}, paramDim);
55665566

55675567
result.push('uniform highp sampler2D user_' + paramName, 'highp ivec2 user_' + paramName + 'Size = ivec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'highp ivec3 user_' + paramName + 'Dim = ivec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform highp int user_' + paramName + 'BitRatio');
5568-
5569-
if (paramType === 'Array') {
5570-
result.push('uniform highp int user_' + paramName + 'BitRatio');
5571-
}
55725568
} else if (paramType === 'Integer') {
55735569
result.push('highp float user_' + paramName + ' = ' + param + '.0');
55745570
} else if (paramType === 'Float') {

bin/gpu.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/backend/web-gl/kernel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ module.exports = function (_KernelBase) {
13131313
floatOutput: this.floatOutput
13141314
}, paramDim);
13151315

1316-
result.push('uniform sampler2D user_' + paramName, 'ivec2 user_' + paramName + 'Size = vec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'ivec3 user_' + paramName + 'Dim = vec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform int user_' + paramName + 'BitRatio');
1316+
result.push('uniform sampler2D user_' + paramName, 'ivec2 user_' + paramName + 'Size = ivec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'ivec3 user_' + paramName + 'Dim = ivec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform int user_' + paramName + 'BitRatio');
13171317
} else if (paramType === 'Integer') {
13181318
result.push('float user_' + paramName + ' = ' + param + '.0');
13191319
} else if (paramType === 'Float') {

dist/backend/web-gl2/kernel.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,6 @@ module.exports = function (_WebGLKernel) {
760760
}, paramDim);
761761

762762
result.push('uniform highp sampler2D user_' + paramName, 'highp ivec2 user_' + paramName + 'Size = ivec2(' + paramSize[0] + ', ' + paramSize[1] + ')', 'highp ivec3 user_' + paramName + 'Dim = ivec3(' + paramDim[0] + ', ' + paramDim[1] + ', ' + paramDim[2] + ')', 'uniform highp int user_' + paramName + 'BitRatio');
763-
764-
if (paramType === 'Array') {
765-
result.push('uniform highp int user_' + paramName + 'BitRatio');
766-
}
767763
} else if (paramType === 'Integer') {
768764
result.push('highp float user_' + paramName + ' = ' + param + '.0');
769765
} else if (paramType === 'Float') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gpu.js",
3-
"version": "1.10.2",
3+
"version": "1.10.3",
44
"description": "GPU Accelerated JavaScript",
55
"main": "./dist/index.js",
66
"files": ["dist", "bin"],

src/backend/web-gl/kernel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,8 +1289,8 @@ module.exports = class WebGLKernel extends KernelBase {
12891289

12901290
result.push(
12911291
`uniform sampler2D user_${ paramName }`,
1292-
`ivec2 user_${ paramName }Size = vec2(${ paramSize[0] }, ${ paramSize[1] })`,
1293-
`ivec3 user_${ paramName }Dim = vec3(${ paramDim[0] }, ${ paramDim[1]}, ${ paramDim[2] })`,
1292+
`ivec2 user_${ paramName }Size = ivec2(${ paramSize[0] }, ${ paramSize[1] })`,
1293+
`ivec3 user_${ paramName }Dim = ivec3(${ paramDim[0] }, ${ paramDim[1]}, ${ paramDim[2] })`,
12941294
`uniform int user_${ paramName }BitRatio`
12951295
);
12961296
} else if (paramType === 'Integer') {

src/backend/web-gl2/kernel.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,6 @@ module.exports = class WebGL2Kernel extends WebGLKernel {
788788
`highp ivec3 user_${ paramName }Dim = ivec3(${ paramDim[0] }, ${ paramDim[1]}, ${ paramDim[2] })`,
789789
`uniform highp int user_${ paramName }BitRatio`
790790
);
791-
792-
if (paramType === 'Array') {
793-
result.push(`uniform highp int user_${ paramName }BitRatio`)
794-
}
795791
} else if (paramType === 'Integer') {
796792
result.push(`highp float user_${ paramName } = ${ param }.0`);
797793
} else if (paramType === 'Float') {

test/all.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@
8888
<script src="issues/359-addfunction-params-wrong.js"></script>
8989
<script src="issues/382-bad-constant.js"></script>
9090
<script src="issues/390-thread-assignment.js"></script>
91+
<script src="issues/399-double-definition.js"></script>
9192
</body>
9293
</html>

0 commit comments

Comments
 (0)