summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2012-09-18 12:32:10 -0700
committerJason Sams <jsams@google.com>2012-09-18 12:32:10 -0700
commit08a81583c18a849e442ceeb8d7baeca743fb3be8 (patch)
treee249bd2794008cd5c21c7b4c23c9e03d441d017f /graphics/jni
parent21dfd7c5fe9e42d2ef3ac7423065c86dfe8f29da (diff)
downloadframeworks_base-08a81583c18a849e442ceeb8d7baeca743fb3be8.zip
frameworks_base-08a81583c18a849e442ceeb8d7baeca743fb3be8.tar.gz
frameworks_base-08a81583c18a849e442ceeb8d7baeca743fb3be8.tar.bz2
Add Kernel, Method, and field IDs
bug 7182873 Change-Id: I066a359bb04027e9376dac088560f042c496b10e
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 2109a01..3f642e8 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -1078,6 +1078,75 @@ nScriptIntrinsicCreate(JNIEnv *_env, jobject _this, RsContext con, jint id, jint
return (jint)rsScriptIntrinsicCreate(con, id, (RsElement)eid);
}
+static jint
+nScriptKernelIDCreate(JNIEnv *_env, jobject _this, RsContext con, jint sid, jint slot, jint sig)
+{
+ LOG_API("nScriptKernelIDCreate, con(%p) script(%p), slot(%i), sig(%i)", con, (void *)sid, slot, sig);
+ return (jint)rsScriptKernelIDCreate(con, (RsScript)sid, slot, sig);
+}
+
+static jint
+nScriptFieldIDCreate(JNIEnv *_env, jobject _this, RsContext con, jint sid, jint slot)
+{
+ LOG_API("nScriptFieldIDCreate, con(%p) script(%p), slot(%i)", con, (void *)sid, slot);
+ return (jint)rsScriptFieldIDCreate(con, (RsScript)sid, slot);
+}
+
+static jint
+nScriptGroupCreate(JNIEnv *_env, jobject _this, RsContext con, jintArray _kernels, jintArray _src,
+ jintArray _dstk, jintArray _dstf, jintArray _types)
+{
+ LOG_API("nScriptGroupCreate, con(%p)", con);
+
+ jint kernelsLen = _env->GetArrayLength(_kernels) * sizeof(int);
+ jint *kernelsPtr = _env->GetIntArrayElements(_kernels, NULL);
+ jint srcLen = _env->GetArrayLength(_src) * sizeof(int);
+ jint *srcPtr = _env->GetIntArrayElements(_src, NULL);
+ jint dstkLen = _env->GetArrayLength(_dstk) * sizeof(int);
+ jint *dstkPtr = _env->GetIntArrayElements(_dstk, NULL);
+ jint dstfLen = _env->GetArrayLength(_dstf) * sizeof(int);
+ jint *dstfPtr = _env->GetIntArrayElements(_dstf, NULL);
+ jint typesLen = _env->GetArrayLength(_types) * sizeof(int);
+ jint *typesPtr = _env->GetIntArrayElements(_types, NULL);
+
+ int id = (int)rsScriptGroupCreate(con,
+ (RsScriptKernelID *)kernelsPtr, kernelsLen,
+ (RsScriptKernelID *)srcPtr, srcLen,
+ (RsScriptKernelID *)dstkPtr, dstkLen,
+ (RsScriptFieldID *)dstfPtr, dstfLen,
+ (RsType *)typesPtr, typesLen);
+
+ _env->ReleaseIntArrayElements(_kernels, kernelsPtr, 0);
+ _env->ReleaseIntArrayElements(_src, srcPtr, 0);
+ _env->ReleaseIntArrayElements(_dstk, dstkPtr, 0);
+ _env->ReleaseIntArrayElements(_dstf, dstfPtr, 0);
+ _env->ReleaseIntArrayElements(_types, typesPtr, 0);
+ return id;
+}
+
+static void
+nScriptGroupSetInput(JNIEnv *_env, jobject _this, RsContext con, jint gid, jint kid, jint alloc)
+{
+ LOG_API("nScriptGroupSetInput, con(%p) group(%p), kernelId(%p), alloc(%p)", con,
+ (void *)gid, (void *)kid, (void *)alloc);
+ rsScriptGroupSetInput(con, (RsScriptGroup)gid, (RsScriptKernelID)kid, (RsAllocation)alloc);
+}
+
+static void
+nScriptGroupSetOutput(JNIEnv *_env, jobject _this, RsContext con, jint gid, jint kid, jint alloc)
+{
+ LOG_API("nScriptGroupSetOutput, con(%p) group(%p), kernelId(%p), alloc(%p)", con,
+ (void *)gid, (void *)kid, (void *)alloc);
+ rsScriptGroupSetOutput(con, (RsScriptGroup)gid, (RsScriptKernelID)kid, (RsAllocation)alloc);
+}
+
+static void
+nScriptGroupExecute(JNIEnv *_env, jobject _this, RsContext con, jint gid)
+{
+ LOG_API("nScriptGroupSetOutput, con(%p) group(%p)", con, (void *)gid);
+ rsScriptGroupExecute(con, (RsScriptGroup)gid);
+}
+
// ---------------------------------------------------------------------------
static jint
@@ -1420,6 +1489,12 @@ static JNINativeMethod methods[] = {
{"rsnScriptCCreate", "(ILjava/lang/String;Ljava/lang/String;[BI)I", (void*)nScriptCCreate },
{"rsnScriptIntrinsicCreate", "(III)I", (void*)nScriptIntrinsicCreate },
+{"rsnScriptKernelIDCreate", "(IIII)I", (void*)nScriptKernelIDCreate },
+{"rsnScriptFieldIDCreate", "(III)I", (void*)nScriptFieldIDCreate },
+{"rsnScriptGroupCreate", "(I[I[I[I[I[I)I", (void*)nScriptGroupCreate },
+{"rsnScriptGroupSetInput", "(IIII)V", (void*)nScriptGroupSetInput },
+{"rsnScriptGroupSetOutput", "(IIII)V", (void*)nScriptGroupSetOutput },
+{"rsnScriptGroupExecute", "(II)V", (void*)nScriptGroupExecute },
{"rsnProgramStoreCreate", "(IZZZZZZIII)I", (void*)nProgramStoreCreate },