summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/Script.java
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2014-06-11 12:01:28 -0700
committerChris Wailes <chriswailes@google.com>2014-07-07 12:27:21 -0700
commit949610653fdf55dd2cb3c846047e6aa2c6d73f0d (patch)
tree3062df8ab3960637b2179d4caf688ca97228e627 /rs/java/android/renderscript/Script.java
parentef2e76675a6c60a2a4764a2e19fdb2c4d9beb00e (diff)
Adds support for multi-input kernels to Frameworks/Base/RS.
* Added a new JNI call to pass arrays of Allocations to the RS runtime. * Added a new version of ForEach that takes an array of Allocations. * Added some casts to disambiguate existing calls to forEach. Change-Id: I46d2834c37075b2a2407fd8b010546818a4540d1
Diffstat (limited to 'rs/java/android/renderscript/Script.java')
-rw-r--r--rs/java/android/renderscript/Script.java49
1 files changed, 48 insertions, 1 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index 0e46f94a583e..c49ef948db97 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -182,6 +182,54 @@ public class Script extends BaseObj {
mRS.nScriptForEachClipped(getID(mRS), slot, in_id, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
}
+ /**
+ * Only intended for use by generated reflected code.
+ *
+ * @hide
+ */
+ protected void forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v) {
+ forEach(slot, ains, aout, v, new LaunchOptions());
+ }
+
+ /**
+ * Only intended for use by generated reflected code.
+ *
+ * @hide
+ */
+ protected void forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v, LaunchOptions sc) {
+ mRS.validate();
+
+ for (Allocation ain : ains) {
+ mRS.validateObject(ain);
+ }
+
+ mRS.validateObject(aout);
+ if (ains == null && aout == null) {
+ throw new RSIllegalArgumentException(
+ "At least one of ain or aout is required to be non-null.");
+ }
+
+ if (sc == null) {
+ forEach(slot, ains, aout, v);
+ return;
+ }
+
+ long[] in_ids = new long[ains.length];
+ for (int index = 0; index < ains.length; ++index) {
+ in_ids[index] = ains[index].getID(mRS);
+ }
+
+ long out_id = 0;
+ if (aout != null) {
+ out_id = aout.getID(mRS);
+ }
+ byte[] params = null;
+ if (v != null) {
+ params = v.getData();
+ }
+ mRS.nScriptForEachMultiClipped(getID(mRS), slot, in_ids, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
+ }
+
Script(long id, RenderScript rs) {
super(id, rs);
}
@@ -477,4 +525,3 @@ public class Script extends BaseObj {
}
}
-