diff options
Diffstat (limited to 'graphics/jni/android_renderscript_RenderScript.cpp')
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 130 |
1 files changed, 122 insertions, 8 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 8757b19..b9f8713 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -725,6 +725,72 @@ nAllocationData2D_alloc(JNIEnv *_env, jobject _this, RsContext con, } static void +nAllocationData3D_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint zoff, jint lod, + jint w, jint h, jint d, jshortArray data, int sizeBytes) +{ + jint len = _env->GetArrayLength(data); + LOG_API("nAllocation3DData_s, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, zoff, w, h, d, len); + jshort *ptr = _env->GetShortArrayElements(data, NULL); + rsAllocation3DData(con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0); + _env->ReleaseShortArrayElements(data, ptr, JNI_ABORT); +} + +static void +nAllocationData3D_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint zoff, jint lod, + jint w, jint h, jint d, jbyteArray data, int sizeBytes) +{ + jint len = _env->GetArrayLength(data); + LOG_API("nAllocation3DData_b, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, zoff, w, h, d, len); + jbyte *ptr = _env->GetByteArrayElements(data, NULL); + rsAllocation3DData(con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0); + _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT); +} + +static void +nAllocationData3D_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint zoff, jint lod, + jint w, jint h, jint d, jintArray data, int sizeBytes) +{ + jint len = _env->GetArrayLength(data); + LOG_API("nAllocation3DData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, zoff, w, h, d, len); + jint *ptr = _env->GetIntArrayElements(data, NULL); + rsAllocation3DData(con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0); + _env->ReleaseIntArrayElements(data, ptr, JNI_ABORT); +} + +static void +nAllocationData3D_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint zoff, jint lod, + jint w, jint h, jint d, jfloatArray data, int sizeBytes) +{ + jint len = _env->GetArrayLength(data); + LOG_API("nAllocation3DData_f, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, zoff, w, h, d, len); + jfloat *ptr = _env->GetFloatArrayElements(data, NULL); + rsAllocation3DData(con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0); + _env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT); +} + +static void +nAllocationData3D_alloc(JNIEnv *_env, jobject _this, RsContext con, + jint dstAlloc, jint dstXoff, jint dstYoff, jint dstZoff, + jint dstMip, + jint width, jint height, jint depth, + jint srcAlloc, jint srcXoff, jint srcYoff, jint srcZoff, + jint srcMip) +{ + LOG_API("nAllocationData3D_alloc, con(%p), dstAlloc(%p), dstXoff(%i), dstYoff(%i)," + " dstMip(%i), width(%i), height(%i)," + " srcAlloc(%p), srcXoff(%i), srcYoff(%i), srcMip(%i)", + con, (RsAllocation)dstAlloc, dstXoff, dstYoff, dstMip, dstFace, + width, height, (RsAllocation)srcAlloc, srcXoff, srcYoff, srcMip, srcFace); + + rsAllocationCopy3DRange(con, + (RsAllocation)dstAlloc, + dstXoff, dstYoff, dstZoff, dstMip, + width, height, depth, + (RsAllocation)srcAlloc, + srcXoff, srcYoff, srcZoff, srcMip); +} + +static void nAllocationRead_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jintArray data) { jint len = _env->GetArrayLength(data); @@ -782,13 +848,6 @@ nAllocationResize1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint rsAllocationResize1D(con, (RsAllocation)alloc, dimX); } -static void -nAllocationResize2D(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint dimX, jint dimY) -{ - LOG_API("nAllocationResize1D, con(%p), alloc(%p), sizeX(%i), sizeY(%i)", con, (RsAllocation)alloc, dimX, dimY); - rsAllocationResize2D(con, (RsAllocation)alloc, dimX, dimY); -} - // ----------------------------------- static int @@ -928,6 +987,15 @@ nScriptSetVarI(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo rsScriptSetVarI(con, (RsScript)script, slot, val); } +static jint +nScriptGetVarI(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot) +{ + LOG_API("nScriptGetVarI, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + int value = 0; + rsScriptGetVarV(con, (RsScript)script, slot, &value, sizeof(value)); + return value; +} + static void nScriptSetVarObj(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jint val) { @@ -942,6 +1010,15 @@ nScriptSetVarJ(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo rsScriptSetVarJ(con, (RsScript)script, slot, val); } +static jlong +nScriptGetVarJ(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot) +{ + LOG_API("nScriptGetVarJ, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jlong value = 0; + rsScriptGetVarV(con, (RsScript)script, slot, &value, sizeof(value)); + return value; +} + static void nScriptSetVarF(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, float val) { @@ -949,6 +1026,15 @@ nScriptSetVarF(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo rsScriptSetVarF(con, (RsScript)script, slot, val); } +static jfloat +nScriptGetVarF(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot) +{ + LOG_API("nScriptGetVarF, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jfloat value = 0; + rsScriptGetVarV(con, (RsScript)script, slot, &value, sizeof(value)); + return value; +} + static void nScriptSetVarD(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, double val) { @@ -956,6 +1042,15 @@ nScriptSetVarD(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo rsScriptSetVarD(con, (RsScript)script, slot, val); } +static jdouble +nScriptGetVarD(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot) +{ + LOG_API("nScriptGetVarD, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jdouble value = 0; + rsScriptGetVarV(con, (RsScript)script, slot, &value, sizeof(value)); + return value; +} + static void nScriptSetVarV(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jbyteArray data) { @@ -967,6 +1062,16 @@ nScriptSetVarV(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo } static void +nScriptGetVarV(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jbyteArray data) +{ + LOG_API("nScriptSetVarV, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + jint len = _env->GetArrayLength(data); + jbyte *ptr = _env->GetByteArrayElements(data, NULL); + rsScriptGetVarV(con, (RsScript)script, slot, ptr, len); + _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT); +} + +static void nScriptSetVarVE(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jbyteArray data, jint elem, jintArray dims) { LOG_API("nScriptSetVarVE, con(%p), s(%p), slot(%i)", con, (void *)script, slot); @@ -1519,13 +1624,17 @@ static JNINativeMethod methods[] = { {"rsnAllocationData2D", "(IIIIIIII[BI)V", (void*)nAllocationData2D_b }, {"rsnAllocationData2D", "(IIIIIIII[FI)V", (void*)nAllocationData2D_f }, {"rsnAllocationData2D", "(IIIIIIIIIIIII)V", (void*)nAllocationData2D_alloc }, +{"rsnAllocationData3D", "(IIIIIIIII[II)V", (void*)nAllocationData3D_i }, +{"rsnAllocationData3D", "(IIIIIIIII[SI)V", (void*)nAllocationData3D_s }, +{"rsnAllocationData3D", "(IIIIIIIII[BI)V", (void*)nAllocationData3D_b }, +{"rsnAllocationData3D", "(IIIIIIIII[FI)V", (void*)nAllocationData3D_f }, +{"rsnAllocationData3D", "(IIIIIIIIIIIIII)V", (void*)nAllocationData3D_alloc }, {"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i }, {"rsnAllocationRead", "(II[S)V", (void*)nAllocationRead_s }, {"rsnAllocationRead", "(II[B)V", (void*)nAllocationRead_b }, {"rsnAllocationRead", "(II[F)V", (void*)nAllocationRead_f }, {"rsnAllocationGetType", "(II)I", (void*)nAllocationGetType}, {"rsnAllocationResize1D", "(III)V", (void*)nAllocationResize1D }, -{"rsnAllocationResize2D", "(IIII)V", (void*)nAllocationResize2D }, {"rsnAllocationGenerateMipmaps", "(II)V", (void*)nAllocationGenerateMipmaps }, {"rsnScriptBindAllocation", "(IIII)V", (void*)nScriptBindAllocation }, @@ -1537,10 +1646,15 @@ static JNINativeMethod methods[] = { {"rsnScriptForEachClipped", "(IIIIIIIIIII)V", (void*)nScriptForEachClipped }, {"rsnScriptForEachClipped", "(IIIII[BIIIIII)V", (void*)nScriptForEachClippedV }, {"rsnScriptSetVarI", "(IIII)V", (void*)nScriptSetVarI }, +{"rsnScriptGetVarI", "(III)I", (void*)nScriptGetVarI }, {"rsnScriptSetVarJ", "(IIIJ)V", (void*)nScriptSetVarJ }, +{"rsnScriptGetVarJ", "(III)J", (void*)nScriptGetVarJ }, {"rsnScriptSetVarF", "(IIIF)V", (void*)nScriptSetVarF }, +{"rsnScriptGetVarF", "(III)F", (void*)nScriptGetVarF }, {"rsnScriptSetVarD", "(IIID)V", (void*)nScriptSetVarD }, +{"rsnScriptGetVarD", "(III)D", (void*)nScriptGetVarD }, {"rsnScriptSetVarV", "(III[B)V", (void*)nScriptSetVarV }, +{"rsnScriptGetVarV", "(III[B)V", (void*)nScriptGetVarV }, {"rsnScriptSetVarVE", "(III[BI[I)V", (void*)nScriptSetVarVE }, {"rsnScriptSetVarObj", "(IIII)V", (void*)nScriptSetVarObj }, |