Validate context when using RS objects.
BUG=6035422
Change-Id: I8586be0085b36767289e1f634111c0ff076cec3c
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java
index 4d60ac8..104d1cd 100644
--- a/graphics/java/android/renderscript/Program.java
+++ b/graphics/java/android/renderscript/Program.java
@@ -134,11 +134,11 @@
throw new IllegalArgumentException("Slot ID out of range.");
}
if (a != null &&
- a.getType().getID() != mConstants[slot].getID()) {
+ a.getType().getID(mRS) != mConstants[slot].getID(mRS)) {
throw new IllegalArgumentException("Allocation type does not match slot type.");
}
- int id = a != null ? a.getID() : 0;
- mRS.nProgramBindConstants(getID(), slot, id);
+ int id = a != null ? a.getID(mRS) : 0;
+ mRS.nProgramBindConstants(getID(mRS), slot, id);
}
/**
@@ -159,8 +159,8 @@
throw new IllegalArgumentException("Cannot bind cubemap to 2d texture slot");
}
- int id = va != null ? va.getID() : 0;
- mRS.nProgramBindTexture(getID(), slot, id);
+ int id = va != null ? va.getID(mRS) : 0;
+ mRS.nProgramBindTexture(getID(mRS), slot, id);
}
/**
@@ -179,8 +179,8 @@
throw new IllegalArgumentException("Slot ID out of range.");
}
- int id = vs != null ? vs.getID() : 0;
- mRS.nProgramBindSampler(getID(), slot, id);
+ int id = vs != null ? vs.getID(mRS) : 0;
+ mRS.nProgramBindSampler(getID(mRS), slot, id);
}