diff options
author | Jason Sams <rjsams@android.com> | 2010-11-04 14:32:19 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-11-04 14:32:19 -0700 |
commit | c1d6210fb5cc558ccea95a59a2b33bb9015fc7de (patch) | |
tree | 554b225d7e1de8017a0faf3171bce66fc028df08 /graphics/java/android/renderscript/Program.java | |
parent | cebfaab7a515d72ec0f965eb65ba4fdb6aba7df0 (diff) |
More RS exceptions cleanup.
Remove some dead code.
Change-Id: If97e3fdfe6de7bb28f22e1c5ee748c81cea3db93
Diffstat (limited to 'graphics/java/android/renderscript/Program.java')
-rw-r--r-- | graphics/java/android/renderscript/Program.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java index ffcdbbc5a818..35236ca14225 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++; |