summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorpathorn@chromium.org <pathorn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 21:25:21 +0000
committerpathorn@chromium.org <pathorn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 21:25:21 +0000
commit73c82a01b553b027854fff4737640074a0103cc5 (patch)
treef5dcc015d82900d7eddc4da5558582d9ea080404 /o3d
parent2f861b3966882a737b125e544373bdd9c84a4977 (diff)
downloadchromium_src-73c82a01b553b027854fff4737640074a0103cc5.zip
chromium_src-73c82a01b553b027854fff4737640074a0103cc5.tar.gz
chromium_src-73c82a01b553b027854fff4737640074a0103cc5.tar.bz2
o3d-webgl: Avoid computation per element if ParamParamArray is bound.
BUG=none TEST=o3d-webgl-samples/convolution.html still works Review URL: http://codereview.chromium.org/2881037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/samples/o3d-webgl/param.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/o3d/samples/o3d-webgl/param.js b/o3d/samples/o3d-webgl/param.js
index 1aae87e..8e3dd8c 100644
--- a/o3d/samples/o3d-webgl/param.js
+++ b/o3d/samples/o3d-webgl/param.js
@@ -840,13 +840,14 @@ o3d.ParamMatrix4.prototype.applyToLocation = function(gl, location) {
* to which to apply the values.
*/
o3d.ParamParamArray.prototype.applyToLocations = function(gl, locationArray) {
- if (locationArray.length != this.value.length) {
+ var computedValue = this.value;
+ if (locationArray.length != computedValue.length) {
gl.client.error_callback(
'Invalid uniform param array: incorrect number of elements.');
}
- for (var i = 0; i < this.value.length; i++) {
+ for (var i = 0; i < computedValue.length; i++) {
// Cannot have a ParamArray of ParamArrays, so safe to call applyToLocation
- this.value.getParam(i).applyToLocation(gl, locationArray[i]);
+ computedValue.getParam(i).applyToLocation(gl, locationArray[i]);
}
};