diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FragmentShader.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FragmentShader.java
index fb81f73..0c6312f 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FragmentShader.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FragmentShader.java
@@ -56,9 +56,15 @@
             return this;
         }
 
+        public Builder addShaderTexture(Program.TextureType texType, String name) {
+            mShader.mShaderTextureNames.add(name);
+            mShader.mShaderTextureTypes.add(texType);
+            return this;
+        }
+
         public Builder addTexture(Program.TextureType texType, String name) {
-            mBuilder.addTexture(texType);
             mShader.mTextureNames.add(name);
+            mShader.mTextureTypes.add(texType);
             return this;
         }
 
@@ -69,6 +75,13 @@
             if (mShader.mPerObjConstants != null) {
                 mBuilder.addConstant(mShader.mPerObjConstants);
             }
+            for (int i = 0; i < mShader.mTextureTypes.size(); i ++) {
+                mBuilder.addTexture(mShader.mTextureTypes.get(i));
+            }
+            for (int i = 0; i < mShader.mShaderTextureTypes.size(); i ++) {
+                mBuilder.addTexture(mShader.mShaderTextureTypes.get(i));
+            }
+
             mShader.mProgram = mBuilder.create();
             return mShader;
         }
@@ -77,7 +90,18 @@
     FragmentShader() {
     }
 
-    public ScriptField_FragmentShader_s getRSData(RenderScriptGL rs) {
+    public void updateTextures(RenderScriptGL rs, Resources res) {
+        int shaderTextureStart = mTextureTypes.size();
+        for (int i = 0; i < mShaderTextureNames.size(); i ++) {
+            ShaderParam sp = mSourceParams.get(mShaderTextureNames.get(i));
+            if (sp != null && sp instanceof TextureParam) {
+                TextureParam p = (TextureParam)sp;
+                mProgram.bindTexture(p.getTexture().getRsData(rs, res), shaderTextureStart + i);
+            }
+        }
+    }
+
+    public ScriptField_FragmentShader_s getRSData(RenderScriptGL rs, Resources res) {
         if (mField != null) {
             return mField;
         }
@@ -85,7 +109,7 @@
         ScriptField_FragmentShader_s.Item item = new ScriptField_FragmentShader_s.Item();
         item.program = mProgram;
 
-        linkConstants(rs);
+        linkConstants(rs, res);
         if (mPerShaderConstants != null) {
             item.shaderConst = mConstantBuffer;
             item.shaderConstParams = mConstantBufferParams;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderState.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderState.java
index 2cc8c6b..8546e95 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderState.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderState.java
@@ -18,6 +18,7 @@
 
 import java.lang.Math;
 import java.util.ArrayList;
+import android.content.res.Resources;
 
 import android.renderscript.Allocation;
 import android.renderscript.Element;
@@ -75,14 +76,14 @@
         mRaster = pr;
     }
 
-    public ScriptField_RenderState_s getRSData(RenderScriptGL rs) {
+    public ScriptField_RenderState_s getRSData(RenderScriptGL rs, Resources res) {
         if (mField != null) {
             return mField;
         }
 
         ScriptField_RenderState_s.Item item = new ScriptField_RenderState_s.Item();
-        item.pv = mVertex.getRSData(rs).getAllocation();
-        item.pf = mFragment.getRSData(rs).getAllocation();
+        item.pv = mVertex.getRSData(rs, res).getAllocation();
+        item.pf = mFragment.getRSData(rs, res).getAllocation();
         item.ps = mStore;
         item.pr = mRaster;
 
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
index c73b32e..cf4a846 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
@@ -231,7 +231,7 @@
             mRsFieldItem.transformMatrix = mTransform.getRSData(rs).getAllocation();
         }
         mRsFieldItem.name = SceneManager.getStringAsAllocation(rs, getName());
-        mRsFieldItem.render_state = mRenderState.getRSData(rs).getAllocation();
+        mRsFieldItem.render_state = mRenderState.getRSData(rs, res).getAllocation();
         mRsFieldItem.bVolInitialized = 0;
         mRsFieldItem.cullType = mCullType;
     }
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
index 3d48547..653ce51 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java
@@ -51,6 +51,22 @@
         }
     }
 
+    private class ShaderImageLoader extends AsyncTask<ArrayList<FragmentShader>, Void, Boolean> {
+        protected Boolean doInBackground(ArrayList<FragmentShader>... objects) {
+            long start = System.currentTimeMillis();
+            for (int i = 0; i < objects[0].size(); i ++) {
+                FragmentShader sI = objects[0].get(i);
+                sI.updateTextures(mRS, mRes);
+            }
+            long end = System.currentTimeMillis();
+            Log.v(TIMER_TAG, "Shader texture init time: " + (end - start));
+            return new Boolean(true);
+        }
+
+        protected void onPostExecute(Boolean result) {
+        }
+    }
+
     CompoundTransform mRootTransforms;
     HashMap<String, Transform> mTransformMap;
     ArrayList<RenderPass> mRenderPasses;
@@ -210,6 +226,7 @@
     }
 
     public void initRenderPassRS(RenderScriptGL rs, SceneManager sceneManager) {
+        new ShaderImageLoader().execute(mFragmentShaders);
         if (mRenderPasses.size() != 0) {
             mRenderPassAlloc = new ScriptField_RenderPass_s(mRS, mRenderPasses.size());
             for (int i = 0; i < mRenderPasses.size(); i ++) {
@@ -246,7 +263,7 @@
         Allocation[] shaderAllocs = new Allocation[mVertexShaders.size()];
         for (int i = 0; i < mVertexShaders.size(); i ++) {
             VertexShader sI = mVertexShaders.get(i);
-            shaderAllocs[i] = sI.getRSData(rs).getAllocation();
+            shaderAllocs[i] = sI.getRSData(rs, res).getAllocation();
         }
         shaderData.copyFrom(shaderAllocs);
         sceneManager.mRenderLoop.set_gVertexShaders(shaderData);
@@ -255,7 +272,7 @@
         shaderAllocs = new Allocation[mFragmentShaders.size()];
         for (int i = 0; i < mFragmentShaders.size(); i ++) {
             FragmentShader sI = mFragmentShaders.get(i);
-            shaderAllocs[i] = sI.getRSData(rs).getAllocation();
+            shaderAllocs[i] = sI.getRSData(rs, res).getAllocation();
         }
         shaderData.copyFrom(shaderAllocs);
         sceneManager.mRenderLoop.set_gFragmentShaders(shaderData);
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Shader.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Shader.java
index 9713eb5..7541115 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Shader.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Shader.java
@@ -22,6 +22,7 @@
 
 import android.content.res.Resources;
 import android.renderscript.*;
+import android.renderscript.ProgramFragment.Builder;
 import android.util.Log;
 
 /**
@@ -33,7 +34,10 @@
 
     protected HashMap<String, ShaderParam> mSourceParams;
     protected ArrayList<ShaderParam> mParamList;
+    protected ArrayList<String> mShaderTextureNames;
+    protected ArrayList<Program.TextureType > mShaderTextureTypes;
     protected ArrayList<String> mTextureNames;
+    protected ArrayList<Program.TextureType > mTextureTypes;
 
     protected Allocation mConstantBuffer;
     protected Allocation mConstantBufferParams;
@@ -41,7 +45,10 @@
     public Shader() {
         mSourceParams = new HashMap<String, ShaderParam>();
         mParamList = new ArrayList<ShaderParam>();
+        mShaderTextureNames = new ArrayList<String>();
+        mShaderTextureTypes = new ArrayList<Program.TextureType>();
         mTextureNames = new ArrayList<String>();
+        mTextureTypes = new ArrayList<Program.TextureType>();
     }
 
     public void appendSourceParams(ShaderParam p) {
@@ -56,7 +63,7 @@
         return mPerObjConstants;
     }
 
-    void linkConstants(RenderScriptGL rs) {
+    void linkConstants(RenderScriptGL rs, Resources res) {
         if (mPerShaderConstants == null) {
             return;
         }
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
index b334b0a..087b776 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
@@ -78,9 +78,8 @@
     private VertexShader mPaintV;
 
     private Allocation mDefaultCube;
-    private Allocation mAllocPV;
-    private Allocation mEnvCube;
-    private Allocation mDiffCube;
+    private TextureCube mEnvCube;
+    private TextureCube mDiffCube;
 
     Scene mActiveScene;
 
@@ -135,35 +134,6 @@
         mSceneManager.loadModel(path, mLoadedCallback);
     }
 
-    // We use this to laod environment maps off the UI thread
-    private class ImageLoaderTask extends AsyncTask<String, Void, Boolean> {
-        Allocation tempEnv;
-        Allocation tempDiff;
-
-        protected Boolean doInBackground(String... names) {
-            long start = System.currentTimeMillis();
-
-            tempEnv = SceneManager.loadCubemap("sdcard/scenegraph/cube_env.png", mRS, mRes);
-            tempDiff = SceneManager.loadCubemap("sdcard/scenegraph/cube_spec.png", mRS, mRes);
-
-            long end = System.currentTimeMillis();
-            Log.v("TIMER", "Image load time: " + (end - start));
-            return new Boolean(true);
-        }
-
-        protected void onPostExecute(Boolean result) {
-            if (tempEnv != null) {
-                mEnvCube = tempEnv;
-                mPaintF.mProgram.bindTexture(mEnvCube, 1);
-            }
-
-            if (tempDiff != null) {
-                mDiffCube = tempDiff;
-                mAluminumF.mProgram.bindTexture(mDiffCube, 1);
-            }
-        }
-    }
-
     public void onActionDown(float x, float y) {
         mTouchHandler.onActionDown(x, y);
 
@@ -184,7 +154,7 @@
         fb.setShader(mRes, id);
         fb.addTexture(TextureType.TEXTURE_2D, "diffuse");
         if (addCubemap) {
-            fb.addTexture(TextureType.TEXTURE_CUBE, "reflection");
+            fb.addShaderTexture(TextureType.TEXTURE_CUBE, "reflection");
         }
         FragmentShader pf = fb.create();
         pf.mProgram.bindSampler(Sampler.WRAP_LINEAR_MIP_LINEAR(mRS), 0);
@@ -209,7 +179,9 @@
         mFsConst2 = new ScriptField_FShaderLightParams_s(mRS, 1);
 
         mPaintF = createFromResource(R.raw.paintf, true);
+        mPaintF.appendSourceParams(new TextureParam("reflection", mEnvCube));
         mAluminumF = createFromResource(R.raw.metal, true);
+        mAluminumF.appendSourceParams(new TextureParam("reflection", mDiffCube));
 
         mPlasticF = createFromResource(R.raw.plastic, false);
         mDiffuseF = createFromResource(R.raw.diffuse, false);
@@ -307,15 +279,10 @@
     private void initRS() {
 
         FullscreenBlur.createRenderTargets(mRS, mWidth, mHeight);
-        initPaintShaders();
-
-        Bitmap b = BitmapFactory.decodeResource(mRes, R.drawable.defaultcube);
-        mDefaultCube = Allocation.createCubemapFromBitmap(mRS, b);
-        mPaintF.mProgram.bindTexture(mDefaultCube, 1);
-        mAluminumF.mProgram.bindTexture(mDefaultCube, 1);
-
         // Reflection maps from SD card
-        new ImageLoaderTask().execute();
+        mEnvCube = new TextureCube("sdcard/scenegraph/", "cube_env.png");
+        mDiffCube = new TextureCube("sdcard/scenegraph/", "cube_spec.png");
+        initPaintShaders();
 
         ScriptC_render renderLoop = mSceneManager.getRenderLoop();
 
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
index fad52d0..e338be4 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
@@ -39,6 +39,11 @@
         setTexture(tex);
     }
 
+    public TextureCube(String dir, String file) {
+        setFileDir(dir);
+        setFileName(file);
+    }
+
     public void setFileDir(String dir) {
         mFileDir = dir;
     }
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureParam.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureParam.java
index df7147a..d7d196b 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureParam.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureParam.java
@@ -34,22 +34,22 @@
  */
 public class TextureParam extends ShaderParam {
 
-    Texture2D mTexture;
+    TextureBase mTexture;
 
     public TextureParam(String name) {
         super(name);
     }
 
-    public TextureParam(String name, Texture2D t) {
+    public TextureParam(String name, TextureBase t) {
         super(name);
         setTexture(t);
     }
 
-    public void setTexture(Texture2D t) {
+    public void setTexture(TextureBase t) {
         mTexture = t;
     }
 
-    public Texture2D getTexture() {
+    public TextureBase getTexture() {
         return mTexture;
     }
 
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/VertexShader.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/VertexShader.java
index 7bf806e..4351f66 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/VertexShader.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/VertexShader.java
@@ -74,7 +74,7 @@
     VertexShader() {
     }
 
-    public ScriptField_VertexShader_s getRSData(RenderScriptGL rs) {
+    public ScriptField_VertexShader_s getRSData(RenderScriptGL rs, Resources res) {
         if (mField != null) {
             return mField;
         }
@@ -82,7 +82,7 @@
         ScriptField_VertexShader_s.Item item = new ScriptField_VertexShader_s.Item();
         item.program = mProgram;
 
-        linkConstants(rs);
+        linkConstants(rs, res);
         if (mPerShaderConstants != null) {
             item.shaderConst = mConstantBuffer;
             item.shaderConstParams = mConstantBufferParams;
