summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2013-04-10 04:21:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-10 04:21:01 +0000
commit07c6fa123da8c7a25edab751543d96fea1dd57f6 (patch)
treef5325ff5ed0350828946fa52ca43adc5bb01385c /graphics/java/android/renderscript/Allocation.java
parent808723f2b8a3842114f064a5ad4ee08fa9698192 (diff)
parentf8c033db1edf36a0ab09568c3142054f0be2d1a1 (diff)
Merge "Implement RS GC worker thread." into jb-mr2-dev
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 54de6aa4240a..914799250729 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -274,12 +274,20 @@ public class Allocation extends BaseObj {
}
}
+ // don't need to account for USAGE_SHARED Allocations
+ if ((usage & USAGE_SHARED) == 0) {
+ int numBytes = t.getCount() * t.getElement().getBytesSize();
+ rs.addAllocSizeForGC(numBytes);
+ mGCSize = numBytes;
+ }
+
mType = t;
mUsage = usage;
if (t != null) {
updateCacheInfo(t);
}
+
}
private void validateIsInt32() {
@@ -1235,6 +1243,7 @@ public class Allocation extends BaseObj {
if (type.getID(rs) == 0) {
throw new RSInvalidStateException("Bad Type");
}
+
int id = rs.nAllocationCreateTyped(type.getID(rs), mips.mID, usage, 0);
if (id == 0) {
throw new RSRuntimeException("Allocation creation failed.");
@@ -1384,7 +1393,6 @@ public class Allocation extends BaseObj {
return alloc;
}
-
int id = rs.nAllocationCreateFromBitmap(t.getID(rs), mips.mID, b, usage);
if (id == 0) {
throw new RSRuntimeException("Load failed.");