summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/renderscript/Program.java
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-11-04 18:21:45 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-04 18:21:45 -0700
commitafb9965fe883f86374c89baeea5ba7d6dcf2184c (patch)
tree171057f48f83dddd1384c5855e1d08b83200bf47 /graphics/java/android/renderscript/Program.java
parent2614c6c1f9fb19af21b901c16c443335bbc9d50b (diff)
parentc1d6210fb5cc558ccea95a59a2b33bb9015fc7de (diff)
downloadframeworks_base-afb9965fe883f86374c89baeea5ba7d6dcf2184c.zip
frameworks_base-afb9965fe883f86374c89baeea5ba7d6dcf2184c.tar.gz
frameworks_base-afb9965fe883f86374c89baeea5ba7d6dcf2184c.tar.bz2
Merge "More RS exceptions cleanup. Remove some dead code."
Diffstat (limited to 'graphics/java/android/renderscript/Program.java')
-rw-r--r--graphics/java/android/renderscript/Program.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java
index ffcdbbc..35236ca 100644
--- a/graphics/java/android/renderscript/Program.java
+++ b/graphics/java/android/renderscript/Program.java
@@ -47,6 +47,13 @@ public class Program extends BaseObj {
}
public void bindConstants(Allocation a, int slot) {
+ if (slot < 0 || slot >= mConstants.length) {
+ throw new IllegalArgumentException("Slot ID out of range.");
+ }
+ if (a != null &&
+ a.getType().getID() != mConstants[slot].getID()) {
+ throw new IllegalArgumentException("Allocation type does not match slot type.");
+ }
mRS.nProgramBindConstants(mID, slot, a.mID);
}
@@ -141,7 +148,10 @@ public class Program extends BaseObj {
public void addInput(Element e) throws IllegalStateException {
// Should check for consistant and non-conflicting names...
if(mInputCount >= MAX_INPUT) {
- throw new IllegalArgumentException("Max input count exceeded.");
+ throw new RSIllegalArgumentException("Max input count exceeded.");
+ }
+ if (e.isComplex()) {
+ throw new RSIllegalArgumentException("Complex elements not allowed.");
}
mInputs[mInputCount++] = e;
}
@@ -149,7 +159,10 @@ public class Program extends BaseObj {
public void addOutput(Element e) throws IllegalStateException {
// Should check for consistant and non-conflicting names...
if(mOutputCount >= MAX_OUTPUT) {
- throw new IllegalArgumentException("Max output count exceeded.");
+ throw new RSIllegalArgumentException("Max output count exceeded.");
+ }
+ if (e.isComplex()) {
+ throw new RSIllegalArgumentException("Complex elements not allowed.");
}
mOutputs[mOutputCount++] = e;
}
@@ -164,7 +177,10 @@ public class Program extends BaseObj {
public int addConstant(Type t) throws IllegalStateException {
// Should check for consistant and non-conflicting names...
if(mConstantCount >= MAX_CONSTANT) {
- throw new IllegalArgumentException("Max input count exceeded.");
+ throw new RSIllegalArgumentException("Max input count exceeded.");
+ }
+ if (t.getElement().isComplex()) {
+ throw new RSIllegalArgumentException("Complex elements not allowed.");
}
mConstants[mConstantCount] = t;
return mConstantCount++;