summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Script.java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2013-02-07 12:16:41 -0800
committerTim Murray <timmurray@google.com>2013-02-07 15:22:36 -0800
commiteb8c29cb7ece3f4b7ad18e5393b07fa7418a541c (patch)
treedf082f98e7d8a22de25dfea441a167d949e4292a /graphics/java/android/renderscript/Script.java
parent36b8d38e20074699857aa030ebd5f304c01da711 (diff)
Add API entry points for clipped kernels.
Change-Id: Idf474a5ac391c41e9215cd2f03e7f8c4bfb875fa
Diffstat (limited to 'graphics/java/android/renderscript/Script.java')
-rw-r--r--graphics/java/android/renderscript/Script.java51
1 files changed, 45 insertions, 6 deletions
diff --git a/graphics/java/android/renderscript/Script.java b/graphics/java/android/renderscript/Script.java
index fe80967e6f35..b53ba0d7e80a 100644
--- a/graphics/java/android/renderscript/Script.java
+++ b/graphics/java/android/renderscript/Script.java
@@ -166,6 +166,25 @@ public class Script extends BaseObj {
mRS.nScriptForEach(getID(mRS), slot, in_id, out_id, params);
}
+ protected void forEach(int slot, Allocation ain, Allocation aout, FieldPacker v, LaunchOptions sc) {
+ if (ain == null && aout == null) {
+ throw new RSIllegalArgumentException(
+ "At least one of ain or aout is required to be non-null.");
+ }
+ int in_id = 0;
+ if (ain != null) {
+ in_id = ain.getID(mRS);
+ }
+ int out_id = 0;
+ if (aout != null) {
+ out_id = aout.getID(mRS);
+ }
+ byte[] params = null;
+ if (v != null) {
+ params = v.getData();
+ }
+ mRS.nScriptForEachClipped(getID(mRS), slot, in_id, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
+ }
Script(int id, RenderScript rs) {
super(id, rs);
@@ -320,29 +339,43 @@ public class Script extends BaseObj {
}
public static final class LaunchOptions {
- protected int xstart = -1;
- protected int ystart = -1;
- protected int xend = -1 ;
- protected int yend = -1;
+ protected int xstart = 0;
+ protected int ystart = 0;
+ protected int xend = 0;
+ protected int yend = 0;
+ protected int zstart = 0;
+ protected int zend = 0;
protected int strategy;
- public void setX(int xstartArg, int xendArg) {
+ public LaunchOptions setX(int xstartArg, int xendArg) {
if (xstartArg < 0 || xendArg <= xstartArg) {
throw new RSIllegalArgumentException("Invalid dimensions");
}
xstart = xstartArg;
xend = xendArg;
+ return this;
}
- public void setY(int ystartArg, int yendArg) {
+ public LaunchOptions setY(int ystartArg, int yendArg) {
if (ystartArg < 0 || yendArg <= ystartArg) {
throw new RSIllegalArgumentException("Invalid dimensions");
}
ystart = ystartArg;
yend = yendArg;
+ return this;
+ }
+
+ public LaunchOptions setZ(int zstartArg, int zendArg) {
+ if (zstartArg < 0 || zendArg <= zstartArg) {
+ throw new RSIllegalArgumentException("Invalid dimensions");
+ }
+ zstart = zstartArg;
+ zend = zendArg;
+ return this;
}
+
public int getXStart() {
return xstart;
}
@@ -355,6 +388,12 @@ public class Script extends BaseObj {
public int getYEnd() {
return yend;
}
+ public int getZStart() {
+ return zstart;
+ }
+ public int getZEnd() {
+ return zend;
+ }
}
}