Validate context when using RS objects.
BUG=6035422
Change-Id: I8586be0085b36767289e1f634111c0ff076cec3c
diff --git a/graphics/java/android/renderscript/Mesh.java b/graphics/java/android/renderscript/Mesh.java
index f641117..ffbb41d 100644
--- a/graphics/java/android/renderscript/Mesh.java
+++ b/graphics/java/android/renderscript/Mesh.java
@@ -137,15 +137,15 @@
@Override
void updateFromNative() {
super.updateFromNative();
- int vtxCount = mRS.nMeshGetVertexBufferCount(getID());
- int idxCount = mRS.nMeshGetIndexCount(getID());
+ int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS));
+ int idxCount = mRS.nMeshGetIndexCount(getID(mRS));
int[] vtxIDs = new int[vtxCount];
int[] idxIDs = new int[idxCount];
int[] primitives = new int[idxCount];
- mRS.nMeshGetVertices(getID(), vtxIDs, vtxCount);
- mRS.nMeshGetIndices(getID(), idxIDs, primitives, idxCount);
+ mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount);
+ mRS.nMeshGetIndices(getID(mRS), idxIDs, primitives, idxCount);
mVertexBuffers = new Allocation[vtxCount];
mIndexBuffers = new Allocation[idxCount];
@@ -343,7 +343,7 @@
alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage);
}
vertexBuffers[ct] = alloc;
- vtx[ct] = alloc.getID();
+ vtx[ct] = alloc.getID(mRS);
}
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
@@ -354,7 +354,7 @@
} else if(entry.e != null) {
alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage);
}
- int allocID = (alloc == null) ? 0 : alloc.getID();
+ int allocID = (alloc == null) ? 0 : alloc.getID(mRS);
indexBuffers[ct] = alloc;
primitives[ct] = entry.prim;
@@ -483,12 +483,12 @@
for(int ct = 0; ct < mVertexTypeCount; ct ++) {
Entry entry = mVertexTypes[ct];
vertexBuffers[ct] = entry.a;
- vtx[ct] = entry.a.getID();
+ vtx[ct] = entry.a.getID(mRS);
}
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
Entry entry = (Entry)mIndexTypes.elementAt(ct);
- int allocID = (entry.a == null) ? 0 : entry.a.getID();
+ int allocID = (entry.a == null) ? 0 : entry.a.getID(mRS);
indexBuffers[ct] = entry.a;
primitives[ct] = entry.prim;