Cleanup mesh creation.

Change-Id: Iaf5e060711dcb6341ac0f337dfb274528cb68d3e
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 00e3a0a..1da00a5 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -403,25 +403,8 @@
 	}
 
 MeshCreate {
+	param RsAllocation *vtx
+	param RsAllocation *idx
+	param uint32_t *primType
 	ret RsMesh
-	param uint32_t vtxCount
-	param uint32_t idxCount
 	}
-
-MeshBindIndex {
-	param RsMesh mesh
-	param RsAllocation idx
-	param uint32_t primType
-	param uint32_t slot
-	}
-
-MeshBindVertex {
-	param RsMesh mesh
-	param RsAllocation vtx
-	param uint32_t slot
-	}
-
-MeshInitVertexAttribs {
-	param RsMesh mesh
-	}
-
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index 35184c1..3d0342d 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -263,30 +263,25 @@
 namespace android {
 namespace renderscript {
 
-RsMesh rsi_MeshCreate(Context *rsc, uint32_t vtxCount, uint32_t idxCount) {
+RsMesh rsi_MeshCreate(Context *rsc,
+                      RsAllocation *vtx, uint32_t vtxCount,
+                      RsAllocation *idx, uint32_t idxCount,
+                      uint32_t *primType, uint32_t primTypeCount) {
+    rsAssert(idxCount == primTypeCount);
     Mesh *sm = new Mesh(rsc, vtxCount, idxCount);
     sm->incUserRef();
 
-    return sm;
-}
+    for (uint32_t i = 0; i < vtxCount; i ++) {
+        sm->setVertexBuffer((Allocation*)vtx[i], i);
+    }
 
-void rsi_MeshBindVertex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t slot) {
-    Mesh *sm = static_cast<Mesh *>(mv);
-    rsAssert(slot < sm->mHal.state.vertexBuffersCount);
+    for (uint32_t i = 0; i < idxCount; i ++) {
+        sm->setPrimitive((Allocation*)idx[i], (RsPrimitive)primType[i], i);
+    }
 
-    sm->setVertexBuffer((Allocation *)va, slot);
-}
-
-void rsi_MeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primType, uint32_t slot) {
-    Mesh *sm = static_cast<Mesh *>(mv);
-    rsAssert(slot < sm->mHal.state.primitivesCount);
-
-    sm->setPrimitive((Allocation *)va, (RsPrimitive)primType, slot);
-}
-
-void rsi_MeshInitVertexAttribs(Context *rsc, RsMesh mv) {
-    Mesh *sm = static_cast<Mesh *>(mv);
     sm->init();
+
+    return sm;
 }
 
 }}
diff --git a/libs/rs/rsMesh.h b/libs/rs/rsMesh.h
index 1e279f4..ed1e93d 100644
--- a/libs/rs/rsMesh.h
+++ b/libs/rs/rsMesh.h
@@ -39,13 +39,6 @@
         RsPrimitive mPrimitive;
     };
 
-    // compatibility to not break the build
-    ObjectBaseRef<Allocation> *mVertexBuffers;
-    uint32_t mVertexBufferCount;
-    Primitive_t ** mPrimitives;
-    uint32_t mPrimitivesCount;
-    // end compatibility
-
     virtual void serialize(OStream *stream) const;
     virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_MESH; }
     static Mesh *createFromStream(Context *rsc, IStream *stream);