summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/SceneGraph/src
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2012-02-07 16:14:11 -0800
committerAlex Sakhartchouk <alexst@google.com>2012-02-07 16:25:25 -0800
commita9eb319965da1f2d59c06135d0d8d4631312bfff (patch)
tree32dd43dcbb94cfa8098ea7f59e189014c78d60a2 /tests/RenderScriptTests/SceneGraph/src
parentf835ca02713e34b0939957389a21022a9a6ce5c9 (diff)
downloadframeworks_base-a9eb319965da1f2d59c06135d0d8d4631312bfff.zip
frameworks_base-a9eb319965da1f2d59c06135d0d8d4631312bfff.tar.gz
frameworks_base-a9eb319965da1f2d59c06135d0d8d4631312bfff.tar.bz2
Making a graceful fallback for missing textures.
Change-Id: Ib628d8344ab9bdd5f82c61a599c42a4c7ca3052e
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/src')
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java14
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Texture2D.java2
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java2
-rw-r--r--tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs1
4 files changed, 10 insertions, 9 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
index 0f14486..f77f483 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/SceneManager.java
@@ -111,8 +111,8 @@ public class SceneManager extends SceneGraphBase {
if (sSceneManager == null) {
return null;
}
- if (sSceneManager.sDefaultCube != null) {
- sSceneManager.sDefault2D = getDefault(true);
+ if (sSceneManager.sDefaultCube == null) {
+ sSceneManager.sDefaultCube = getDefault(true);
}
return sSceneManager.sDefaultCube;
}
@@ -156,6 +156,9 @@ public class SceneManager extends SceneGraphBase {
public static Allocation loadCubemap(String name, RenderScriptGL rs, Resources res) {
Bitmap b = loadBitmap(name, res);
+ if (b == null) {
+ return null;
+ }
return Allocation.createCubemapFromBitmap(rs, b,
MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
Allocation.USAGE_GRAPHICS_TEXTURE);
@@ -163,6 +166,9 @@ public class SceneManager extends SceneGraphBase {
public static Allocation loadTexture2D(String name, RenderScriptGL rs, Resources res) {
Bitmap b = loadBitmap(name, res);
+ if (b == null) {
+ return null;
+ }
return Allocation.createFromBitmap(rs, b,
Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
Allocation.USAGE_GRAPHICS_TEXTURE);
@@ -336,10 +342,6 @@ public class SceneManager extends SceneGraphBase {
mRenderLoop.set_gVertexParamsScript(mVertexParamsScript);
mRenderLoop.set_gCullScript(mCullScript);
- Allocation checker = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.checker,
- MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
- Allocation.USAGE_GRAPHICS_TEXTURE);
- mRenderLoop.set_gTGrid(checker);
mRenderLoop.set_gPFSBackground(ProgramStore.BLEND_NONE_DEPTH_TEST(mRS));
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Texture2D.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Texture2D.java
index 0809df8..8fae9d9 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Texture2D.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Texture2D.java
@@ -53,7 +53,7 @@ public class Texture2D extends TextureBase {
}
public void setTexture(Allocation tex) {
- mData.texture = tex;
+ mData.texture = tex != null ? tex : SceneManager.getDefaultTex2D();
if (mField != null) {
mField.set_texture(0, mData.texture, true);
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
index 05870e7..12c81c2 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/TextureCube.java
@@ -60,7 +60,7 @@ public class TextureCube extends TextureBase {
}
public void setTexture(Allocation tex) {
- mData.texture = tex;
+ mData.texture = tex != null ? tex : SceneManager.getDefaultTexCube();
if (mField != null) {
mField.set_texture(0, mData.texture, true);
}
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
index aea0113..d8d48b3 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs
@@ -37,7 +37,6 @@ rs_allocation gRenderableObjects;
rs_allocation gRenderPasses;
// Temporary shaders
-rs_allocation gTGrid;
rs_program_store gPFSBackground;
uint32_t *gFrontToBack;