diff options
author | Jason Sams <rjsams@android.com> | 2010-05-11 14:03:58 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-05-11 14:03:58 -0700 |
commit | 4d3399337d18ef04116bc8a2e5799274655d0c30 (patch) | |
tree | a264ecb82632516adb510a2ca49d3cac750d54d0 /graphics/jni | |
parent | 810f5ccb99a8a05a6d1617b19a4efb2399450318 (diff) | |
download | frameworks_base-4d3399337d18ef04116bc8a2e5799274655d0c30.zip frameworks_base-4d3399337d18ef04116bc8a2e5799274655d0c30.tar.gz frameworks_base-4d3399337d18ef04116bc8a2e5799274655d0c30.tar.bz2 |
Convert renderscript from using ACC to LLVM for its compiler.
This will also require application to be updated to support
the new compiler and data passing models.
Change-Id: If078e3a5148af395ba1b936169a407d8c3ad727f
Diffstat (limited to 'graphics/jni')
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 45cc72e..2a7ad38 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -854,6 +854,33 @@ nScriptBindAllocation(JNIEnv *_env, jobject _this, jint script, jint alloc, jint } static void +nScriptSetVarI(JNIEnv *_env, jobject _this, jint script, jint slot, jint val) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("nScriptSetVarI, con(%p), s(%p), slot(%i), val(%i), b(%f), a(%f)", con, (void *)script, slot, val); + rsScriptSetVarI(con, (RsScript)script, slot, val); +} + +static void +nScriptSetVarF(JNIEnv *_env, jobject _this, jint script, jint slot, float val) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("nScriptSetVarI, con(%p), s(%p), slot(%i), val(%i), b(%f), a(%f)", con, (void *)script, slot, val); + rsScriptSetVarF(con, (RsScript)script, slot, val); +} + +static void +nScriptSetVarV(JNIEnv *_env, jobject _this, jint script, jint slot, jbyteArray data) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + LOG_API("nScriptSetVarV, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jint len = _env->GetArrayLength(data); + jbyte *ptr = _env->GetByteArrayElements(data, NULL); + rsScriptSetVarV(con, (RsScript)script, slot, ptr, len); + _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT); +} + +static void nScriptSetClearColor(JNIEnv *_env, jobject _this, jint script, jfloat r, jfloat g, jfloat b, jfloat a) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); @@ -895,41 +922,31 @@ nScriptSetTimeZone(JNIEnv *_env, jobject _this, jint script, jbyteArray timeZone } static void -nScriptSetType(JNIEnv *_env, jobject _this, jint type, jboolean writable, jstring _str, jint slot) +nScriptInvoke(JNIEnv *_env, jobject _this, jint obj, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - LOG_API("nScriptCAddType, con(%p), type(%p), writable(%i), slot(%i)", con, (RsType)type, writable, slot); - const char* n = NULL; - if (_str) { - n = _env->GetStringUTFChars(_str, NULL); - } - rsScriptSetType(con, (RsType)type, slot, writable, n); - if (n) { - _env->ReleaseStringUTFChars(_str, n); - } + LOG_API("nScriptInvoke, con(%p), script(%p)", con, (void *)obj); + rsScriptInvoke(con, (RsScript)obj, slot); } static void -nScriptSetInvoke(JNIEnv *_env, jobject _this, jstring _str, jint slot) +nScriptInvokeData(JNIEnv *_env, jobject _this, jint obj, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - LOG_API("nScriptSetInvoke, con(%p)", con); - const char* n = NULL; - if (_str) { - n = _env->GetStringUTFChars(_str, NULL); - } - rsScriptSetInvoke(con, n, slot); - if (n) { - _env->ReleaseStringUTFChars(_str, n); - } + LOG_API("nScriptInvokeData, con(%p), script(%p)", con, (void *)obj); + rsScriptInvokeData(con, (RsScript)obj, slot, 0); } + static void -nScriptInvoke(JNIEnv *_env, jobject _this, jint obj, jint slot) +nScriptInvokeV(JNIEnv *_env, jobject _this, jint script, jint slot, jbyteArray data) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - LOG_API("nScriptInvoke, con(%p), script(%p)", con, (void *)obj); - rsScriptInvoke(con, (RsScript)obj, slot); + LOG_API("nScriptInvokeV, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jint len = _env->GetArrayLength(data); + jbyte *ptr = _env->GetByteArrayElements(data, NULL); + rsScriptInvokeV(con, (RsScript)script, slot, ptr, len); + _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT); } static void @@ -1424,16 +1441,17 @@ static JNINativeMethod methods[] = { {"nScriptSetClearDepth", "(IF)V", (void*)nScriptSetClearDepth }, {"nScriptSetClearStencil", "(II)V", (void*)nScriptSetClearStencil }, {"nScriptSetTimeZone", "(I[B)V", (void*)nScriptSetTimeZone }, -{"nScriptSetType", "(IZLjava/lang/String;I)V", (void*)nScriptSetType }, {"nScriptSetRoot", "(Z)V", (void*)nScriptSetRoot }, -{"nScriptSetInvokable", "(Ljava/lang/String;I)V", (void*)nScriptSetInvoke }, {"nScriptInvoke", "(II)V", (void*)nScriptInvoke }, +{"nScriptInvokeData", "(II)V", (void*)nScriptInvokeData }, +{"nScriptInvokeV", "(II[B)V", (void*)nScriptInvokeV }, +{"nScriptSetVarI", "(III)V", (void*)nScriptSetVarI }, +{"nScriptSetVarF", "(IIF)V", (void*)nScriptSetVarF }, +{"nScriptSetVarV", "(II[B)V", (void*)nScriptSetVarV }, {"nScriptCBegin", "()V", (void*)nScriptCBegin }, {"nScriptCSetScript", "([BII)V", (void*)nScriptCSetScript }, {"nScriptCCreate", "()I", (void*)nScriptCCreate }, -{"nScriptCAddDefineI32", "(Ljava/lang/String;I)V", (void*)nScriptCAddDefineI32 }, -{"nScriptCAddDefineF", "(Ljava/lang/String;F)V", (void*)nScriptCAddDefineF }, {"nProgramFragmentStoreBegin", "(II)V", (void*)nProgramFragmentStoreBegin }, {"nProgramFragmentStoreDepthFunc", "(I)V", (void*)nProgramFragmentStoreDepthFunc }, |