summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/Script.java
diff options
context:
space:
mode:
Diffstat (limited to 'rs/java/android/renderscript/Script.java')
-rw-r--r--rs/java/android/renderscript/Script.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index dda468a0de02..7cd6d09e2812 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -182,9 +182,9 @@ public class Script extends BaseObj {
mRS.validateObject(ain);
mRS.validateObject(aout);
- if (ain == null && aout == null) {
+ if (ain == null && aout == null && sc == null) {
throw new RSIllegalArgumentException(
- "At least one of ain or aout is required to be non-null.");
+ "At least one of input allocation, output allocation, or LaunchOptions is required to be non-null.");
}
long[] in_ids = null;
@@ -220,22 +220,21 @@ public class Script extends BaseObj {
/**
* Only intended for use by generated reflected code.
- *
- * @hide
*/
protected void forEach(int slot, Allocation[] ains, Allocation aout,
FieldPacker v) {
+
+ // FieldPacker is kept here to support regular params in the future.
forEach(slot, ains, aout, v, null);
}
/**
* Only intended for use by generated reflected code.
- *
- * @hide
*/
protected void forEach(int slot, Allocation[] ains, Allocation aout,
FieldPacker v, LaunchOptions sc) {
// TODO: Is this necessary if nScriptForEach calls validate as well?
+ // FieldPacker is kept here to support regular params in the future.
mRS.validate();
if (ains != null) {
for (Allocation ain : ains) {
@@ -474,7 +473,23 @@ public class Script extends BaseObj {
/**
- * Class used to specify clipping for a kernel launch.
+ * Class for specifying the specifics about how a kernel will be
+ * launched
+ *
+ * This class can specify a potential range of cells on which to
+ * run a kernel. If no set is called for a dimension then this
+ * class will have no impact on that dimension when the kernel
+ * is executed.
+ *
+ * The forEach launch will operate over the intersection of the
+ * dimensions.
+ *
+ * Example:
+ * LaunchOptions with setX(5, 15)
+ * Allocation with dimension X=10, Y=10
+ * The resulting forEach run would execute over x = 5 to 10 and
+ * y = 0 to 10.
+ *
*
*/
public static final class LaunchOptions {