diff options
| author | Alex Sakhartchouk <alexst@google.com> | 2011-05-12 10:38:03 -0700 |
|---|---|---|
| committer | Alex Sakhartchouk <alexst@google.com> | 2011-05-12 10:49:39 -0700 |
| commit | 25999a08a6652ff5d7d0973f279f1e92e04b3506 (patch) | |
| tree | fd3a2678fee9bcf1217e03c17d9cb8a080ffacb7 /graphics/jni | |
| parent | 415c842aa6dd3cc797ed2ef1ae42351f594a6c74 (diff) | |
| download | frameworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.zip frameworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.tar.gz frameworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.tar.bz2 | |
Cleanup mesh creation.
Change-Id: Iaf5e060711dcb6341ac0f337dfb274528cb68d3e
Diffstat (limited to 'graphics/jni')
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 2eaedaa..26a6287 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -1075,35 +1075,28 @@ nSamplerCreate(JNIEnv *_env, jobject _this, RsContext con, jint magFilter, jint // --------------------------------------------------------------------------- static jint -nMeshCreate(JNIEnv *_env, jobject _this, RsContext con, jint vtxCount, jint idxCount) +nMeshCreate(JNIEnv *_env, jobject _this, RsContext con, jintArray _vtx, jintArray _idx, jintArray _prim) { - LOG_API("nMeshCreate, con(%p), vtxCount(%i), idxCount(%i)", con, vtxCount, idxCount); - int id = (int)rsMeshCreate(con, vtxCount, idxCount); - return id; -} + LOG_API("nMeshCreate, con(%p)", con); -static void -nMeshBindVertex(JNIEnv *_env, jobject _this, RsContext con, jint mesh, jint alloc, jint slot) -{ - LOG_API("nMeshBindVertex, con(%p), Mesh(%p), Alloc(%p), slot(%i)", con, (RsMesh)mesh, (RsAllocation)alloc, slot); - rsMeshBindVertex(con, (RsMesh)mesh, (RsAllocation)alloc, slot); -} + jint vtxLen = _env->GetArrayLength(_vtx); + jint *vtxPtr = _env->GetIntArrayElements(_vtx, NULL); + jint idxLen = _env->GetArrayLength(_idx); + jint *idxPtr = _env->GetIntArrayElements(_idx, NULL); + jint primLen = _env->GetArrayLength(_prim); + jint *primPtr = _env->GetIntArrayElements(_prim, NULL); -static void -nMeshBindIndex(JNIEnv *_env, jobject _this, RsContext con, jint mesh, jint alloc, jint primID, jint slot) -{ - LOG_API("nMeshBindIndex, con(%p), Mesh(%p), Alloc(%p)", con, (RsMesh)mesh, (RsAllocation)alloc); - rsMeshBindIndex(con, (RsMesh)mesh, (RsAllocation)alloc, primID, slot); -} + int id = (int)rsMeshCreate(con, + (RsAllocation *)vtxPtr, vtxLen, + (RsAllocation *)idxPtr, idxLen, + (uint32_t *)primPtr, primLen); -static void -nMeshInitVertexAttribs(JNIEnv *_env, jobject _this, RsContext con, jint mesh) -{ - LOG_API("nMeshInitVertexAttribs, con(%p), Mesh(%p)", con, (RsMesh)mesh); - rsMeshInitVertexAttribs(con, (RsMesh)mesh); + _env->ReleaseIntArrayElements(_vtx, vtxPtr, 0); + _env->ReleaseIntArrayElements(_idx, idxPtr, 0); + _env->ReleaseIntArrayElements(_prim, primPtr, 0); + return id; } - static jint nMeshGetVertexBufferCount(JNIEnv *_env, jobject _this, RsContext con, jint mesh) { @@ -1267,10 +1260,7 @@ static JNINativeMethod methods[] = { {"rsnSamplerCreate", "(IIIIIIF)I", (void*)nSamplerCreate }, -{"rsnMeshCreate", "(III)I", (void*)nMeshCreate }, -{"rsnMeshBindVertex", "(IIII)V", (void*)nMeshBindVertex }, -{"rsnMeshBindIndex", "(IIIII)V", (void*)nMeshBindIndex }, -{"rsnMeshInitVertexAttribs", "(II)V", (void*)nMeshInitVertexAttribs }, +{"rsnMeshCreate", "(I[I[I[I)I", (void*)nMeshCreate }, {"rsnMeshGetVertexBufferCount", "(II)I", (void*)nMeshGetVertexBufferCount }, {"rsnMeshGetIndexCount", "(II)I", (void*)nMeshGetIndexCount }, |
