summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/SceneGraph/src
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2012-01-11 16:13:02 -0800
committerAlex Sakhartchouk <alexst@google.com>2012-01-11 16:13:02 -0800
commitbe5bdeb9471c4a04905edd34e6d3560315293427 (patch)
tree9b78d6d75caeb007b506aef8ddf28c726bf9db10 /tests/RenderScriptTests/SceneGraph/src
parent1a33f00af3b66d487794c2d0550a8631f2d204bb (diff)
downloadframeworks_base-be5bdeb9471c4a04905edd34e6d3560315293427.zip
frameworks_base-be5bdeb9471c4a04905edd34e6d3560315293427.tar.gz
frameworks_base-be5bdeb9471c4a04905edd34e6d3560315293427.tar.bz2
More general texture handling. Some cleanup.
Change-Id: Ia1b14dcb922bda62f380e419281d6e027ad86ecd
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/src')
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Float4Param.java40
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java35
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java6
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java12
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppLoadingScreen.java125
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java141
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs10
7 files changed, 217 insertions, 152 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Float4Param.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Float4Param.java
index aaa4951..f3f69e0 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Float4Param.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Float4Param.java
@@ -43,6 +43,40 @@ public class Float4Param extends ShaderParam {
mValue = new Float4();
}
+ public Float4Param(String name, float value) {
+ super(name);
+ mValue = new Float4();
+ mValue.x = value;
+ mVecSize = 1;
+ }
+
+ public Float4Param(String name, float x, float y) {
+ super(name);
+ mValue = new Float4();
+ mValue.x = x;
+ mValue.y = y;
+ mVecSize = 2;
+ }
+
+ public Float4Param(String name, float x, float y, float z) {
+ super(name);
+ mValue = new Float4();
+ mValue.x = x;
+ mValue.y = y;
+ mValue.z = z;
+ mVecSize = 3;
+ }
+
+ public Float4Param(String name, float x, float y, float z, float w) {
+ super(name);
+ mValue = new Float4();
+ mValue.x = x;
+ mValue.y = y;
+ mValue.z = z;
+ mValue.w = w;
+ mVecSize = 4;
+ }
+
public void setValue(Float4 v) {
mValue = v;
}
@@ -69,11 +103,11 @@ public class Float4Param extends ShaderParam {
paramType = FLOAT4_CAMERA_POS;
} else if(mParamName.equalsIgnoreCase(cameraDir)) {
paramType = FLOAT4_CAMERA_DIR;
- } else if(mParamName.equalsIgnoreCase(lightColor)) {
+ } else if(mParamName.startsWith(lightColor)) {
paramType = FLOAT4_LIGHT_COLOR;
- } else if(mParamName.equalsIgnoreCase(lightPos)) {
+ } else if(mParamName.startsWith(lightPos)) {
paramType = FLOAT4_LIGHT_POS;
- } else if(mParamName.equalsIgnoreCase(lightDir)) {
+ } else if(mParamName.startsWith(lightDir)) {
paramType = FLOAT4_LIGHT_DIR;
}
return paramType;
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
index 8c6b5fc..ffe0092 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/FullscreenBlur.java
@@ -17,6 +17,10 @@
package com.android.scenegraph;
+import java.util.ArrayList;
+
+import com.android.scenegraph.Float4Param;
+
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -29,8 +33,6 @@ import android.renderscript.Program.TextureType;
import android.renderscript.ProgramStore.DepthFunc;
import android.util.Log;
-import java.util.ArrayList;
-
class FullscreenBlur {
static Allocation sRenderTargetBlur0Color;
@@ -135,6 +137,13 @@ class FullscreenBlur {
// Make blur shape
quad = sceneManager.getRenderableQuad("ScreenAlignedQuadH", hBlur);
quad.updateTextures(rs, sRenderTargetBlur2Color, 0);
+
+ float xAdvance = 1.0f / (float)sRenderTargetBlur0Color.getType().getX();
+ quad.appendSourceParams(new Float4Param("blurOffset0", - xAdvance * 2.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset1", - xAdvance * 0.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset2", xAdvance * 1.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset3", xAdvance * 3.5f));
+
horizontalBlurPass.appendRenderable(quad);
scene.appendRenderPass(horizontalBlurPass);
@@ -147,6 +156,12 @@ class FullscreenBlur {
// Make blur shape
quad = sceneManager.getRenderableQuad("ScreenAlignedQuadV", vBlur);
quad.updateTextures(rs, sRenderTargetBlur1Color, 0);
+ float yAdvance = 1.0f / (float)sRenderTargetBlur0Color.getType().getY();
+ quad.appendSourceParams(new Float4Param("blurOffset0", - yAdvance * 2.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset1", - yAdvance * 0.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset2", yAdvance * 1.5f));
+ quad.appendSourceParams(new Float4Param("blurOffset3", yAdvance * 3.5f));
+
verticalBlurPass.appendRenderable(quad);
scene.appendRenderPass(verticalBlurPass);
@@ -198,37 +213,23 @@ class FullscreenBlur {
mPF_Texture.bindSampler(Sampler.WRAP_LINEAR_MIP_LINEAR(rs), 0);
mFsBlurHConst = new ScriptField_FBlurOffsets_s(rs, 1);
- float xAdvance = 1.0f / (float)sRenderTargetBlur0Color.getType().getX();
- ScriptField_FBlurOffsets_s.Item item = new ScriptField_FBlurOffsets_s.Item();
- item.blurOffset0 = - xAdvance * 2.5f;
- item.blurOffset1 = - xAdvance * 0.5f;
- item.blurOffset2 = xAdvance * 1.5f;
- item.blurOffset3 = xAdvance * 3.5f;
- mFsBlurHConst.set(item, 0, true);
fb = new ProgramFragment.Builder(rs);
fb.addConstant(mFsBlurHConst.getAllocation().getType());
fb.setShader(res, R.raw.blur_h);
fb.addTexture(TextureType.TEXTURE_2D);
mPF_BlurH = fb.create();
- mPF_BlurH.bindConstants(mFsBlurHConst.getAllocation(), 0);
mPF_BlurH.bindTexture(sRenderTargetBlur0Color, 0);
mPF_BlurH.bindSampler(Sampler.CLAMP_LINEAR(rs), 0);
mFsBlurVConst = new ScriptField_FBlurOffsets_s(rs, 1);
- float yAdvance = 1.0f / (float)sRenderTargetBlur0Color.getType().getY();
- item.blurOffset0 = - yAdvance * 2.5f;
- item.blurOffset1 = - yAdvance * 0.5f;
- item.blurOffset2 = yAdvance * 1.5f;
- item.blurOffset3 = yAdvance * 3.5f;
- mFsBlurVConst.set(item, 0, true);
fb = new ProgramFragment.Builder(rs);
fb.addConstant(mFsBlurVConst.getAllocation().getType());
fb.setShader(res, R.raw.blur_v);
fb.addTexture(TextureType.TEXTURE_2D);
+
mPF_BlurV = fb.create();
- mPF_BlurV.bindConstants(mFsBlurVConst.getAllocation(), 0);
mPF_BlurV.bindTexture(sRenderTargetBlur1Color, 0);
mPF_BlurV.bindSampler(Sampler.CLAMP_LINEAR(rs), 0);
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
index e42a8ef..d78d889 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Renderable.java
@@ -133,14 +133,16 @@ public class Renderable extends RenderableBase {
void updateTextures(RenderScriptGL rs, Resources res) {
Iterator<ShaderParam> allParamsIter = mSourceParams.values().iterator();
+ int paramIndex = 0;
while (allParamsIter.hasNext()) {
ShaderParam sp = allParamsIter.next();
if (sp instanceof TextureParam) {
TextureParam p = (TextureParam)sp;
- mRsFieldItem.pf_textures[0] = p.getTexture().getRsData(rs, res);
- break;
+ mRsFieldItem.pf_textures[paramIndex++] = p.getTexture().getRsData(rs, res);
}
}
+ ProgramFragment pf = mRenderState.mFragment;
+ mRsFieldItem.pf_num_textures = pf != null ? Math.min(pf.getTextureCount(), paramIndex) : 0;
mRsField.set(mRsFieldItem, 0, true);
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
index 7e12bbd..92cb538 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
@@ -68,16 +68,6 @@ public class SceneManager extends SceneGraphBase {
}
}
- private void initPFS() {
- ProgramStore.Builder b = new ProgramStore.Builder(mRS);
-
- b.setDepthFunc(ProgramStore.DepthFunc.LESS);
- b.setDitherEnabled(false);
- b.setDepthMaskEnabled(true);
-
- mRenderLoop.set_gPFSBackground(b.create());
- }
-
public SceneManager() {
}
@@ -143,7 +133,7 @@ public class SceneManager extends SceneGraphBase {
MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
Allocation.USAGE_GRAPHICS_TEXTURE);
mRenderLoop.set_gTGrid(checker);
- initPFS();
+ mRenderLoop.set_gPFSBackground(ProgramStore.BLEND_NONE_DEPTH_TEST(mRS));
}
public ScriptC_render getRenderLoop() {
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppLoadingScreen.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppLoadingScreen.java
new file mode 100644
index 0000000..db238a2
--- /dev/null
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppLoadingScreen.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.scenegraph;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.BufferedInputStream;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.AsyncTask;
+import android.renderscript.*;
+import android.renderscript.Allocation.MipmapControl;
+import android.renderscript.Element.Builder;
+import android.renderscript.Font.Style;
+import android.renderscript.Program.TextureType;
+import android.renderscript.ProgramStore.DepthFunc;
+import android.util.Log;
+
+import com.android.scenegraph.SceneManager.SceneLoadedCallback;
+
+// This is where the scenegraph and the rendered objects are initialized and used
+public class TestAppLoadingScreen {
+
+ private static String TAG = "TestAppLoadingScreen";
+
+ int mWidth;
+ int mHeight;
+
+ private Resources mRes;
+ private RenderScriptGL mRS;
+ private ScriptC_scenegraph mScript;
+
+ public TestAppLoadingScreen(RenderScriptGL rs, Resources res) {
+ mRS = rs;
+ mRes = res;
+ // Shows the loading screen with some text
+ renderLoading();
+ // Adds a little 3D bugdroid model to the laoding screen asynchronously.
+ new LoadingScreenLoaderTask().execute();
+ }
+
+ public void showLoadingScreen(boolean show) {
+ mScript.set_gInitialized(!show);
+ }
+
+ // The loading screen has some elements that shouldn't be loaded on the UI thread
+ private class LoadingScreenLoaderTask extends AsyncTask<String, Void, Boolean> {
+ Allocation robotTex;
+ Mesh robotMesh;
+ protected Boolean doInBackground(String... names) {
+ long start = System.currentTimeMillis();
+ robotTex = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.robot,
+ MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
+ Allocation.USAGE_GRAPHICS_TEXTURE);
+
+ FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot);
+ FileA3D.IndexEntry entry = model.getIndexEntry(0);
+ if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) {
+ robotMesh = entry.getMesh();
+ }
+
+ mScript.set_gPFSBackground(ProgramStore.BLEND_NONE_DEPTH_TEST(mRS));
+
+ ProgramFragmentFixedFunction.Builder b = new ProgramFragmentFixedFunction.Builder(mRS);
+ b.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.REPLACE,
+ ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
+ ProgramFragment pfDefault = b.create();
+ pfDefault.bindSampler(Sampler.CLAMP_LINEAR(mRS), 0);
+ mScript.set_gPFBackground(pfDefault);
+
+ ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS);
+ ProgramVertexFixedFunction pvDefault = pvb.create();
+ ProgramVertexFixedFunction.Constants va = new ProgramVertexFixedFunction.Constants(mRS);
+ ((ProgramVertexFixedFunction)pvDefault).bindConstants(va);
+ mScript.set_gPVBackground(pvDefault);
+
+ long end = System.currentTimeMillis();
+ Log.v("TIMER", "Loading load time: " + (end - start));
+ return new Boolean(true);
+ }
+
+ protected void onPostExecute(Boolean result) {
+ mScript.set_gRobotTex(robotTex);
+ mScript.set_gRobotMesh(robotMesh);
+ }
+ }
+
+ // Creates a simple script to show a loding screen until everything is initialized
+ // Could also be used to do some custom renderscript work before handing things over
+ // to the scenegraph
+ void renderLoading() {
+ mScript = new ScriptC_scenegraph(mRS, mRes, R.raw.scenegraph);
+ mRS.bindRootScript(mScript);
+ }
+
+
+ public void setRenderLoop(ScriptC renderLoop) {
+ mScript.set_gRenderLoop(renderLoop);
+ Allocation dummyAlloc = Allocation.createSized(mRS, Element.I32(mRS), 1);
+ mScript.set_gDummyAlloc(dummyAlloc);
+ }
+}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
index 58af120..9377aa7 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TestAppRS.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,6 +57,8 @@ public class TestAppRS {
boolean mUseBlur;
+ TestAppLoadingScreen mLoadingScreen;
+
// Used to asynchronously load scene elements like meshes and transform hierarchies
SceneLoadedCallback mLoadedCallback = new SceneLoadedCallback() {
public void run() {
@@ -70,6 +72,25 @@ public class TestAppRS {
// Used to move the camera around in the 3D world
TouchHandler mTouchHandler;
+ private Resources mRes;
+ private RenderScriptGL mRS;
+
+ private ProgramFragment mPF_Paint;
+ private ProgramFragment mPF_Aluminum;
+ private ProgramFragment mPF_Plastic;
+ private ProgramFragment mPF_Diffuse;
+ private ProgramFragment mPF_Texture;
+ ScriptField_FShaderParams_s mFsConst;
+ private ProgramVertex mPV_Paint;
+ ScriptField_VShaderParams_s mVsConst;
+
+ private Allocation mDefaultCube;
+ private Allocation mAllocPV;
+ private Allocation mEnvCube;
+ private Allocation mDiffCube;
+
+ Scene mActiveScene;
+
public TestAppRS() {
mUseBlur = false;
}
@@ -104,10 +125,7 @@ public class TestAppRS {
// Initializes all the RS specific scenegraph elements
mSceneManager.initRS(mRS, mRes, mWidth, mHeight);
- // Shows the loading screen with some text
- renderLoading();
- // Adds a little 3D bugdroid model to the laoding screen asynchronously.
- new LoadingScreenLoaderTask().execute();
+ mLoadingScreen = new TestAppLoadingScreen(mRS, mRes);
// Initi renderscript stuff specific to the app. This will need to be abstracted out later.
initRS();
@@ -120,68 +138,11 @@ public class TestAppRS {
void loadModel(String path) {
//String shortName = path.substring(path.lastIndexOf('/') + 1);
//shortName = shortName.substring(0, shortName.lastIndexOf('.'));
- mScript.set_gInitialized(false);
+ mLoadingScreen.showLoadingScreen(true);
mActiveScene.destroyRS(mSceneManager);
mSceneManager.loadModel(path, mLoadedCallback);
}
- private Resources mRes;
- private RenderScriptGL mRS;
- private Sampler mSampler;
- private ProgramStore mPSBackground;
- private ProgramFragment mPFBackground;
- private ProgramVertex mPVBackground;
- private ProgramVertexFixedFunction.Constants mPVA;
-
- private ProgramFragment mPF_Paint;
- private ProgramFragment mPF_Aluminum;
- private ProgramFragment mPF_Plastic;
- private ProgramFragment mPF_Diffuse;
- private ProgramFragment mPF_Texture;
- ScriptField_FShaderParams_s mFsConst;
- private ProgramVertex mPV_Paint;
- ScriptField_VShaderParams_s mVsConst;
-
- private Allocation mDefaultCube;
- private Allocation mAllocPV;
- private Allocation mEnvCube;
- private Allocation mDiffCube;
-
- Scene mActiveScene;
-
- private ScriptC_scenegraph mScript;
-
- // The loading screen has some elements that shouldn't be loaded on the UI thread
- private class LoadingScreenLoaderTask extends AsyncTask<String, Void, Boolean> {
- Allocation robotTex;
- Mesh robotMesh;
- protected Boolean doInBackground(String... names) {
- long start = System.currentTimeMillis();
- robotTex = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.robot,
- MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
- Allocation.USAGE_GRAPHICS_TEXTURE);
-
- FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.robot);
- FileA3D.IndexEntry entry = model.getIndexEntry(0);
- if (entry != null && entry.getEntryType() == FileA3D.EntryType.MESH) {
- robotMesh = entry.getMesh();
- }
-
- initPFS();
- initPF();
- initPV();
-
- long end = System.currentTimeMillis();
- Log.v("TIMER", "Loading load time: " + (end - start));
- return new Boolean(true);
- }
-
- protected void onPostExecute(Boolean result) {
- mScript.set_gRobotTex(robotTex);
- mScript.set_gRobotMesh(robotMesh);
- }
- }
-
// We use this to laod environment maps off the UI thread
private class ImageLoaderTask extends AsyncTask<String, Void, Boolean> {
Allocation tempEnv;
@@ -290,54 +251,6 @@ public class TestAppRS {
FullscreenBlur.initShaders(mRes, mRS, mVsConst, mFsConst);
}
- // This needs to be cleaned up a bit, it's one of the default render state objects
- private void initPFS() {
- ProgramStore.Builder b = new ProgramStore.Builder(mRS);
-
- b.setDepthFunc(ProgramStore.DepthFunc.LESS);
- b.setDitherEnabled(false);
- b.setDepthMaskEnabled(true);
- mPSBackground = b.create();
-
- mScript.set_gPFSBackground(mPSBackground);
- }
-
- // This needs to be cleaned up a bit, it's one of the default render state objects
- private void initPF() {
- Sampler.Builder bs = new Sampler.Builder(mRS);
- bs.setMinification(Sampler.Value.LINEAR);
- bs.setMagnification(Sampler.Value.LINEAR);
- bs.setWrapS(Sampler.Value.CLAMP);
- bs.setWrapT(Sampler.Value.CLAMP);
- mSampler = bs.create();
-
- ProgramFragmentFixedFunction.Builder b = new ProgramFragmentFixedFunction.Builder(mRS);
- b.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.REPLACE,
- ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
- mPFBackground = b.create();
- mPFBackground.bindSampler(Sampler.CLAMP_LINEAR(mRS), 0);
-
- mScript.set_gPFBackground(mPFBackground);
- }
-
- private void initPV() {
- ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS);
- mPVBackground = pvb.create();
-
- mPVA = new ProgramVertexFixedFunction.Constants(mRS);
- ((ProgramVertexFixedFunction)mPVBackground).bindConstants(mPVA);
-
- mScript.set_gPVBackground(mPVBackground);
- }
-
- // Creates a simple script to show a loding screen until everything is initialized
- // Could also be used to do some custom renderscript work before handing things over
- // to the scenegraph
- void renderLoading() {
- mScript = new ScriptC_scenegraph(mRS, mRes, R.raw.scenegraph);
- mRS.bindRootScript(mScript);
- }
-
void initRenderPasses() {
ArrayList<RenderableBase> allDraw = mActiveScene.getRenderables();
int numDraw = allDraw.size();
@@ -403,7 +316,7 @@ public class TestAppRS {
long end = System.currentTimeMillis();
Log.v("TIMER", "Scene init time: " + (end - start));
- mScript.set_gInitialized(true);
+ mLoadingScreen.showLoadingScreen(false);
}
private void initRS() {
@@ -421,8 +334,6 @@ public class TestAppRS {
ScriptC_render renderLoop = mSceneManager.getRenderLoop();
- mScript.set_gRenderLoop(renderLoop);
- Allocation dummyAlloc = Allocation.createSized(mRS, Element.I32(mRS), 1);
- mScript.set_gDummyAlloc(dummyAlloc);
+ mLoadingScreen.setRenderLoop(renderLoop);
}
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
index fc337f5..c63b680 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
@@ -75,10 +75,12 @@ static void draw(SgRenderable *obj) {
rsgBindProgramFragment(renderState->pf);
rsgBindProgramVertex(renderState->pv);
- if (rsIsObject(obj->pf_textures[0])) {
- rsgBindTexture(renderState->pf, 0, obj->pf_textures[0]);
- } else {
- rsgBindTexture(renderState->pf, 0, gTGrid);
+ for (uint32_t i = 0; i < obj->pf_num_textures; i ++) {
+ if (rsIsObject(obj->pf_textures[i])) {
+ rsgBindTexture(renderState->pf, i, obj->pf_textures[i]);
+ } else {
+ rsgBindTexture(renderState->pf, i, gTGrid);
+ }
}
rsgDrawMesh(obj->mesh, obj->meshIndex);