summaryrefslogtreecommitdiffstats
path: root/graphics/jni/android_renderscript_RenderScript.cpp
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-08-09 22:57:44 -0700
committerJoe Onorato <joeo@android.com>2009-08-09 22:58:20 -0700
commitd7b3774da62d3c70cc7e8cf549967a1c823501e6 (patch)
tree42fa1d36c3a0d2d07850352758bfc22650d60308 /graphics/jni/android_renderscript_RenderScript.cpp
parent3370ec9e54c373ccca3c4f545b4c96f9419a081d (diff)
downloadframeworks_base-d7b3774da62d3c70cc7e8cf549967a1c823501e6.zip
frameworks_base-d7b3774da62d3c70cc7e8cf549967a1c823501e6.tar.gz
frameworks_base-d7b3774da62d3c70cc7e8cf549967a1c823501e6.tar.bz2
Let java put #defines into renderscript
Diffstat (limited to 'graphics/jni/android_renderscript_RenderScript.cpp')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 06525fc..2c3a6cb 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -765,6 +765,26 @@ nScriptCCreate(JNIEnv *_env, jobject _this)
return (jint)rsScriptCCreate();
}
+static void
+nScriptCAddDefineI32(JNIEnv *_env, jobject _this, jstring name, jint value)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ const char* n = _env->GetStringUTFChars(name, NULL);
+ LOG_API("nScriptCAddDefineI32, con(%p) name(%s) value(%d)", con, n, value);
+ rsScriptCSetDefineI32(n, value);
+ _env->ReleaseStringUTFChars(name, n);
+}
+
+static void
+nScriptCAddDefineF(JNIEnv *_env, jobject _this, jstring name, jfloat value)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ const char* n = _env->GetStringUTFChars(name, NULL);
+ LOG_API("nScriptCAddDefineF, con(%p) name(%s) value(%f)", con, n, value);
+ rsScriptCSetDefineF(n, value);
+ _env->ReleaseStringUTFChars(name, n);
+}
+
// ---------------------------------------------------------------------------
static void
@@ -985,6 +1005,27 @@ nContextBindProgramVertex(JNIEnv *_env, jobject _this, jint pf)
rsContextBindProgramVertex((RsProgramVertex)pf);
}
+static void
+nContextAddDefineI32(JNIEnv *_env, jobject _this, jstring name, jint value)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ const char* n = _env->GetStringUTFChars(name, NULL);
+ LOG_API("nScriptCAddDefineI32, con(%p) name(%s) value(%d)", con, n, value);
+ rsContextSetDefineI32(n, value);
+ _env->ReleaseStringUTFChars(name, n);
+}
+
+static void
+nContextAddDefineF(JNIEnv *_env, jobject _this, jstring name, jfloat value)
+{
+ RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+ const char* n = _env->GetStringUTFChars(name, NULL);
+ LOG_API("nScriptCAddDefineF, con(%p) name(%s) value(%f)", con, n, value);
+ rsContextSetDefineF(n, value);
+ _env->ReleaseStringUTFChars(name, n);
+}
+
+
// ---------------------------------------------------------------------------
static void
@@ -1197,6 +1238,8 @@ static JNINativeMethod methods[] = {
{"nScriptCSetRoot", "(Z)V", (void*)nScriptCSetRoot },
{"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 },