aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 6a337d00..5cf8f8d3 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1504,10 +1504,6 @@ var LibraryGL = {
if (!cacheItem[attribute.type]) cacheItem[attribute.type] = {};
cacheItem = cacheItem[attribute.type];
}
- if (GL.currProgram) {
- if (!cacheItem[GL.currProgram]) cacheItem[GL.currProgram] = {};
- cacheItem = cacheItem[GL.currProgram];
- }
if (GLEmulation.fogEnabled) {
var fogParam = GLEmulation.fogMode;
} else {
@@ -1515,6 +1511,10 @@ var LibraryGL = {
}
if (!cacheItem[fogParam]) cacheItem[fogParam] = {};
cacheItem = cacheItem[fogParam];
+ if (GL.currProgram) { // Note the order here; this one is last, and optional
+ if (!cacheItem[GL.currProgram]) cacheItem[GL.currProgram] = {};
+ cacheItem = cacheItem[GL.currProgram];
+ }
if (!cacheItem.renderer) {
#if GL_DEBUG
Module.printErr('generating renderer for ' + JSON.stringify(attributes));