Start of mesh API cleanup.
Switched all native code to go through Mesh class.
Removed SimpleMesh
Added java Mesh class
Will need to port all existing code to use java Mesh, then remove java SimpleMesh.
Change-Id: Idb9c03d0b06b4ef87db28dffcffa1881d39120e5
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index c61a215..a6d2489 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -1351,6 +1351,33 @@
// ---------------------------------------------------------------------------
static jint
+nMeshCreate(JNIEnv *_env, jobject _this, jint vtxCount, jint idxCount)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nMeshCreate, con(%p), vtxCount(%i), idxCount(%i)", con, vtxCount, idxCount);
+ int id = (int)rsMeshCreate(con, vtxCount, idxCount);
+ return id;
+}
+
+static void
+nMeshBindVertex(JNIEnv *_env, jobject _this, jint s, jint alloc, jint slot)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nMeshBindVertex, con(%p), Mesh(%p), Alloc(%p), slot(%i)", con, (RsMesh)s, (RsAllocation)alloc, slot);
+ rsMeshBindVertex(con, (RsMesh)s, (RsAllocation)alloc, slot);
+}
+
+static void
+nMeshBindIndex(JNIEnv *_env, jobject _this, jint s, jint alloc, jint primID, jint slot)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ LOG_API("nMeshBindIndex, con(%p), Mesh(%p), Alloc(%p)", con, (RsMesh)s, (RsAllocation)alloc);
+ rsMeshBindIndex(con, (RsMesh)s, (RsAllocation)alloc, primID, slot);
+}
+
+// ---------------------------------------------------------------------------
+
+static jint
nSimpleMeshCreate(JNIEnv *_env, jobject _this, jint batchID, jint indexID, jintArray vtxIDs, jint primID)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
@@ -1367,16 +1394,16 @@
nSimpleMeshBindVertex(JNIEnv *_env, jobject _this, jint s, jint alloc, jint slot)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nSimpleMeshBindVertex, con(%p), SimpleMesh(%p), Alloc(%p), slot(%i)", con, (RsSimpleMesh)s, (RsAllocation)alloc, slot);
- rsSimpleMeshBindVertex(con, (RsSimpleMesh)s, (RsAllocation)alloc, slot);
+ LOG_API("nSimpleMeshBindVertex, con(%p), Mesh(%p), Alloc(%p), slot(%i)", con, (RsMesh)s, (RsAllocation)alloc, slot);
+ rsSimpleMeshBindVertex(con, (RsMesh)s, (RsAllocation)alloc, slot);
}
static void
nSimpleMeshBindIndex(JNIEnv *_env, jobject _this, jint s, jint alloc)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nSimpleMeshBindIndex, con(%p), SimpleMesh(%p), Alloc(%p)", con, (RsSimpleMesh)s, (RsAllocation)alloc);
- rsSimpleMeshBindIndex(con, (RsSimpleMesh)s, (RsAllocation)alloc);
+ LOG_API("nSimpleMeshBindIndex, con(%p), Mesh(%p), Alloc(%p)", con, (RsMesh)s, (RsAllocation)alloc);
+ rsSimpleMeshBindIndex(con, (RsMesh)s, (RsAllocation)alloc);
}
// ---------------------------------------------------------------------------
@@ -1513,6 +1540,10 @@
{"nSimpleMeshBindVertex", "(III)V", (void*)nSimpleMeshBindVertex },
{"nSimpleMeshBindIndex", "(II)V", (void*)nSimpleMeshBindIndex },
+{"nMeshCreate", "(II)I", (void*)nMeshCreate },
+{"nMeshBindVertex", "(III)V", (void*)nMeshBindVertex },
+{"nMeshBindIndex", "(IIII)V", (void*)nMeshBindIndex },
+
};
static int registerFuncs(JNIEnv *_env)