am 3fb6feac: Merge "Check that bound allocations are 1D"

* commit '3fb6feacc62e1021c705b53d46e915ecf50582d2':
  Check that bound allocations are 1D
This commit is contained in:
Tim Murray
2014-02-03 14:41:39 -08:00
committed by Android Git Automerger

View File

@@ -188,6 +188,13 @@ public class Script extends BaseObj {
public void bindAllocation(Allocation va, int slot) { public void bindAllocation(Allocation va, int slot) {
mRS.validate(); mRS.validate();
if (va != null) { if (va != null) {
if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) {
final Type t = va.mType;
if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) || (t.getZ() != 0)) {
throw new RSIllegalArgumentException(
"API 20+ only allows simple 1D allocations to be used with bind.");
}
}
mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot); mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot);
} else { } else {
mRS.nScriptBindAllocation(getID(mRS), 0, slot); mRS.nScriptBindAllocation(getID(mRS), 0, slot);