Populate java objects with native data from a3d file.
Remove legacy constructor from programraster
Make a3d object creation synchronous

Change-Id: Ic7d7547cf6eee6f9a7c6e3ee12cd104e80056a7b
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 1719029..1b81591 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -78,6 +78,19 @@
 	ret RsElement
 	}
 
+ElementGetNativeData {
+	param RsElement elem
+	param uint32_t *elemData
+	param uint32_t elemDataSize
+	}
+
+ElementGetSubElements {
+	param RsElement elem
+	param uint32_t *ids
+	param const char **names
+	param uint32_t dataSize
+	}
+
 TypeBegin {
 	param RsElement type
 	}
@@ -91,6 +104,12 @@
 	ret RsType
 	}
 
+TypeGetNativeData {
+	param RsType type
+	param uint32_t * typeData
+	param uint32_t typeDataSize
+	}
+
 AllocationCreateTyped {
 	param RsType type
 	ret RsAllocation
@@ -231,6 +250,11 @@
 	param const void *data
 	}
 
+AllocationGetType {
+	param RsAllocation va
+	ret const void*
+	}
+
 SamplerBegin {
 	}
 
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index aa20275..37b8bd6 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -293,6 +293,32 @@
     return (RsElement)e;
 }
 
+void rsi_ElementGetNativeData(Context *rsc, RsElement elem, uint32_t *elemData, uint32_t elemDataSize)
+{
+    rsAssert(elemDataSize == 5);
+    // we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
+    Element *e = static_cast<Element *>(elem);
+
+    (*elemData++) = (uint32_t)e->getType();
+    (*elemData++) = (uint32_t)e->getKind();
+    (*elemData++) = e->getComponent().getIsNormalized() ? 1 : 0;
+    (*elemData++) = e->getComponent().getVectorSize();
+    (*elemData++) = e->getFieldCount();
+
+}
+
+void rsi_ElementGetSubElements(Context *rsc, RsElement elem, uint32_t *ids, const char **names, uint32_t dataSize)
+{
+    Element *e = static_cast<Element *>(elem);
+    rsAssert(e->getFieldCount() == dataSize);
+
+    for(uint32_t i = 0; i < dataSize; i ++) {
+        ids[i] = (uint32_t)e->getField(i);
+        names[i] = e->getFieldName(i);
+    }
+
+}
+
 
 }
 }
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 8dca0fe..52e0d52 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -91,7 +91,7 @@
     if (mLODCount != oldLODCount) {
         if(mLODs){
             delete [] mLODs;
-        }        
+        }
         mLODs = new LOD[mLODCount];
     }
 
@@ -340,6 +340,22 @@
     return st;
 }
 
+void rsi_TypeGetNativeData(Context *rsc, RsType type, uint32_t *typeData, uint32_t typeDataSize)
+{
+    rsAssert(typeDataSize == 6);
+    // Pack the data in the follofing way mDimX; mDimY; mDimZ;
+    // mDimLOD; mDimFaces; mElement; into typeData
+    Type *t = static_cast<Type *>(type);
+
+    (*typeData++) = t->getDimX();
+    (*typeData++) = t->getDimY();
+    (*typeData++) = t->getDimZ();
+    (*typeData++) = t->getDimLOD();
+    (*typeData++) = t->getDimFaces() ? 1 : 0;
+    (*typeData++) = (uint32_t)t->getElement();
+
+}
+
 
 }
 }