summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/RenderScript.java
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2012-02-24 16:22:16 -0800
committerJason Sams <rjsams@android.com>2012-02-24 16:22:16 -0800
commita6f338ca5f0c8359d1952167858851dd025e47e2 (patch)
treea35f3d74cf0a27eda412ae5c60166bb5b097ba02 /graphics/java/android/renderscript/RenderScript.java
parent9733f2609312d1ad93344eb64aa40ecb665b1c4b (diff)
Do RS caching the same way HardwareRenderer does.
Eliminates the need for an application context for caching. Change-Id: I4374738083b5eb4ce983d2cb5409428e3668c423
Diffstat (limited to 'graphics/java/android/renderscript/RenderScript.java')
-rw-r--r--graphics/java/android/renderscript/RenderScript.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 95175135cf3a..fd4ecf160bbe 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -17,6 +17,7 @@
package android.renderscript;
import java.lang.reflect.Field;
+import java.io.File;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -82,6 +83,26 @@ public class RenderScript {
native void nContextInitToClient(int con);
native void nContextDeinitToClient(int con);
+ /**
+ * Name of the file that holds the object cache.
+ */
+ private static final String CACHE_PATH = "com.android.renderscript.cache";
+
+ /**
+ * Sets the directory to use as a persistent storage for the
+ * renderscript object file cache.
+ *
+ * @hide
+ * @param cacheDir A directory the current process can write to
+ */
+
+ static String mCachePath;
+ public static void setupDiskCache(File cacheDir) {
+ File f = new File(cacheDir, CACHE_PATH);
+ mCachePath = f.getAbsolutePath();
+ f.mkdirs();
+ }
+
// Methods below are wrapped to protect the non-threadsafe
// lockless fifo.