mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
Merge pull request #271 from gpujs/270-falsey
fix, test, bump version number, and make.
This commit is contained in:
commit
71fa13b6bc
@ -4,8 +4,8 @@
|
||||
*
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 1.0.3
|
||||
* @date Wed Feb 28 2018 22:04:12 GMT-0500 (EST)
|
||||
* @version 1.0.4
|
||||
* @date Thu Mar 01 2018 15:56:51 GMT-0500 (EST)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
|
||||
4
bin/gpu-core.min.js
vendored
4
bin/gpu-core.min.js
vendored
@ -4,8 +4,8 @@
|
||||
*
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 1.0.3
|
||||
* @date Wed Feb 28 2018 22:04:12 GMT-0500 (EST)
|
||||
* @version 1.0.4
|
||||
* @date Thu Mar 01 2018 15:56:51 GMT-0500 (EST)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
|
||||
12
bin/gpu.js
12
bin/gpu.js
@ -4,8 +4,8 @@
|
||||
*
|
||||
* GPU Accelerated JavaScript
|
||||
*
|
||||
* @version 1.0.3
|
||||
* @date Wed Feb 28 2018 22:04:13 GMT-0500 (EST)
|
||||
* @version 1.0.4
|
||||
* @date Thu Mar 01 2018 15:56:51 GMT-0500 (EST)
|
||||
*
|
||||
* @license MIT
|
||||
* The MIT License
|
||||
@ -3211,12 +3211,10 @@ module.exports = function (_KernelBase) {
|
||||
}, {
|
||||
key: 'getUniformLocation',
|
||||
value: function getUniformLocation(name) {
|
||||
var location = this.programUniformLocationCache[name];
|
||||
if (!location) {
|
||||
location = this._webGl.getUniformLocation(this.program, name);
|
||||
this.programUniformLocationCache[name] = location;
|
||||
if (this.programUniformLocationCache.hasOwnProperty(name)) {
|
||||
return this.programUniformLocationCache[name];
|
||||
}
|
||||
return location;
|
||||
return this.programUniformLocationCache[name] = this._webGl.getUniformLocation(this.program, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
10
bin/gpu.min.js
vendored
10
bin/gpu.min.js
vendored
File diff suppressed because one or more lines are too long
8
dist/backend/web-gl/kernel.js
vendored
8
dist/backend/web-gl/kernel.js
vendored
@ -571,12 +571,10 @@ module.exports = function (_KernelBase) {
|
||||
}, {
|
||||
key: 'getUniformLocation',
|
||||
value: function getUniformLocation(name) {
|
||||
var location = this.programUniformLocationCache[name];
|
||||
if (!location) {
|
||||
location = this._webGl.getUniformLocation(this.program, name);
|
||||
this.programUniformLocationCache[name] = location;
|
||||
if (this.programUniformLocationCache.hasOwnProperty(name)) {
|
||||
return this.programUniformLocationCache[name];
|
||||
}
|
||||
return location;
|
||||
return this.programUniformLocationCache[name] = this._webGl.getUniformLocation(this.program, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gpu.js",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "GPU Accelerated JavaScript",
|
||||
"main": "./dist/index.js",
|
||||
"directories": {
|
||||
|
||||
@ -532,12 +532,10 @@ module.exports = class WebGLKernel extends KernelBase {
|
||||
*
|
||||
*/
|
||||
getUniformLocation(name) {
|
||||
let location = this.programUniformLocationCache[name];
|
||||
if (!location) {
|
||||
location = this._webGl.getUniformLocation(this.program, name);
|
||||
this.programUniformLocationCache[name] = location;
|
||||
if (this.programUniformLocationCache.hasOwnProperty(name)) {
|
||||
return this.programUniformLocationCache[name];
|
||||
}
|
||||
return location;
|
||||
return this.programUniformLocationCache[name] = this._webGl.getUniformLocation(this.program, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
1
test/html/test-all.html
vendored
1
test/html/test-all.html
vendored
@ -57,5 +57,6 @@
|
||||
<script src="../src/issues/259-atan2.js"></script>
|
||||
<script src="../src/issues/263-to-string.js"></script>
|
||||
<script src="../src/issues/267-immutable-sub-kernels.js"></script>
|
||||
<script src="../src/issues/270-cache.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
9
test/src/issues/270-cache.js
Normal file
9
test/src/issues/270-cache.js
Normal file
@ -0,0 +1,9 @@
|
||||
QUnit.test('Issue #270 WebGlKernel getUniformLocation caches falsey - gpu', () => {
|
||||
const kernel = new GPU.WebGLKernel('', {});
|
||||
kernel.programUniformLocationCache.test = false;
|
||||
kernel._webGl = {};
|
||||
kernel._webGl.getUniformLocation = () => {
|
||||
throw new Error('tried to get getUniformLocation when falsey');
|
||||
};
|
||||
QUnit.assert.equal(kernel.getUniformLocation('test'), false);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user