summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2014-02-03 22:44:51 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-03 22:44:51 +0000
commit923da98f792d97638f78f311ac80cac53e306408 (patch)
tree659fce26271980f995c1ef3109b6251ab0bf699c /graphics
parent4e5e654e7aac2212e40915df16fe6ad8598fb4bc (diff)
parentbccee732b53d06c0e983b3f325e0d9ad889de134 (diff)
downloadframeworks_base-923da98f792d97638f78f311ac80cac53e306408.zip
frameworks_base-923da98f792d97638f78f311ac80cac53e306408.tar.gz
frameworks_base-923da98f792d97638f78f311ac80cac53e306408.tar.bz2
am bccee732: am 61eb6b55: Merge "Use Object + type in place of specific array"
* commit 'bccee732b53d06c0e983b3f325e0d9ad889de134': Use Object + type in place of specific array
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/Allocation.java24
-rw-r--r--graphics/java/android/renderscript/RenderScript.java68
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp200
3 files changed, 97 insertions, 195 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index bb1e743..0cafdd7 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -801,7 +801,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -817,7 +817,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 2, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_16);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -833,7 +833,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_8);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -849,7 +849,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.FLOAT_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -955,7 +955,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length);
+ w, h, data, data.length, Element.DataType.SIGNED_8);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -964,7 +964,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 2);
+ w, h, data, data.length * 2, Element.DataType.SIGNED_16);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -973,7 +973,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4);
+ w, h, data, data.length * 4, Element.DataType.SIGNED_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -982,7 +982,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4);
+ w, h, data, data.length * 4, Element.DataType.FLOAT_32);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -1128,7 +1128,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length);
+ w, h, d, data, data.length, Element.DataType.SIGNED_8);
}
/**
@@ -1139,7 +1139,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 2);
+ w, h, d, data, data.length * 2, Element.DataType.SIGNED_16);
}
/**
@@ -1150,7 +1150,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4);
+ w, h, d, data, data.length * 4, Element.DataType.SIGNED_32);
}
/**
@@ -1161,7 +1161,7 @@ public class Allocation extends BaseObj {
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4);
+ w, h, d, data, data.length * 4, Element.DataType.FLOAT_32);
}
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 7d4a5c4..da0cfeb 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -386,25 +386,10 @@ public class RenderScript {
}
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, int[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, int[] d, int sizeBytes) {
+ native void rsnAllocationData1D(int con, int id, int off, int mip, int count, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData1D(int id, int off, int mip, int count, Object d, int sizeBytes, Element.DataType dt) {
validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, short[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, short[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, byte[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, byte[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
- }
- native void rsnAllocationData1D(int con, int id, int off, int mip, int count, float[] d, int sizeBytes);
- synchronized void nAllocationData1D(int id, int off, int mip, int count, float[] d, int sizeBytes) {
- validate();
- rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes);
+ rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes, dt.mID);
}
native void rsnAllocationElementData1D(int con, int id, int xoff, int mip, int compIdx, byte[] d, int sizeBytes);
@@ -433,25 +418,12 @@ public class RenderScript {
srcMip, srcFace);
}
- native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, byte[] d, int sizeBytes);
- synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, byte[] d, int sizeBytes) {
- validate();
- rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
- }
- native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, short[] d, int sizeBytes);
- synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, short[] d, int sizeBytes) {
- validate();
- rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
- }
- native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes);
- synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, int[] d, int sizeBytes) {
+ native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face,
+ int w, int h, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face,
+ int w, int h, Object d, int sizeBytes, Element.DataType dt) {
validate();
- rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
- }
- native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, int w, int h, float[] d, int sizeBytes);
- synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, float[] d, int sizeBytes) {
- validate();
- rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes);
+ rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes, dt.mID);
}
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, Bitmap b);
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, Bitmap b) {
@@ -477,27 +449,13 @@ public class RenderScript {
srcAlloc, srcXoff, srcYoff, srcZoff, srcMip);
}
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, byte[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, byte[] d, int sizeBytes) {
+ native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip,
+ int w, int h, int depth, Object d, int sizeBytes, int dt);
+ synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip,
+ int w, int h, int depth, Object d, int sizeBytes, Element.DataType dt) {
validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
+ rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes, dt.mID);
}
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, short[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, short[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, int[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, int[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
- native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, float[] d, int sizeBytes);
- synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, float[] d, int sizeBytes) {
- validate();
- rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes);
- }
-
native void rsnAllocationRead(int con, int id, byte[] d);
synchronized void nAllocationRead(int id, byte[] d) {
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index afba1a6..03b2d91 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -50,6 +50,56 @@
using namespace android;
+#define PER_ARRAY_TYPE(flag, fnc, ...) { \
+ jint len = 0; \
+ void *ptr = NULL; \
+ switch(dataType) { \
+ case RS_TYPE_FLOAT_32: \
+ len = _env->GetArrayLength((jfloatArray)data); \
+ ptr = _env->GetFloatArrayElements((jfloatArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseFloatArrayElements((jfloatArray)data, (jfloat *)ptr, JNI_ABORT); \
+ return; \
+ case RS_TYPE_FLOAT_64: \
+ len = _env->GetArrayLength((jdoubleArray)data); \
+ ptr = _env->GetDoubleArrayElements((jdoubleArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseDoubleArrayElements((jdoubleArray)data, (jdouble *)ptr, JNI_ABORT);\
+ return; \
+ case RS_TYPE_SIGNED_8: \
+ case RS_TYPE_UNSIGNED_8: \
+ len = _env->GetArrayLength((jbyteArray)data); \
+ ptr = _env->GetByteArrayElements((jbyteArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseByteArrayElements((jbyteArray)data, (jbyte*)ptr, JNI_ABORT); \
+ return; \
+ case RS_TYPE_SIGNED_16: \
+ case RS_TYPE_UNSIGNED_16: \
+ len = _env->GetArrayLength((jshortArray)data); \
+ ptr = _env->GetShortArrayElements((jshortArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseShortArrayElements((jshortArray)data, (jshort *)ptr, JNI_ABORT); \
+ return; \
+ case RS_TYPE_SIGNED_32: \
+ case RS_TYPE_UNSIGNED_32: \
+ len = _env->GetArrayLength((jintArray)data); \
+ ptr = _env->GetIntArrayElements((jintArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseIntArrayElements((jintArray)data, (jint *)ptr, JNI_ABORT); \
+ return; \
+ case RS_TYPE_SIGNED_64: \
+ case RS_TYPE_UNSIGNED_64: \
+ len = _env->GetArrayLength((jlongArray)data); \
+ ptr = _env->GetLongArrayElements((jlongArray)data, flag); \
+ fnc(__VA_ARGS__); \
+ _env->ReleaseLongArrayElements((jlongArray)data, (jlong *)ptr, JNI_ABORT); \
+ return; \
+ default: \
+ break; \
+ } \
+}
+
+
class AutoJavaStringToUTF8 {
public:
AutoJavaStringToUTF8(JNIEnv* env, jstring str) : fEnv(env), fJStr(str) {
@@ -605,43 +655,13 @@ static void ReleaseBitmapCallback(void *bmp)
static void
-nAllocationData1D_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint offset, jint lod, jint count, jintArray data, int sizeBytes)
+nAllocationData1D(JNIEnv *_env, jobject _this, RsContext con, jint _alloc, jint offset, jint lod,
+ jint count, jobject data, int sizeBytes, int dataType)
{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation1DData_i, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, count, len, sizeBytes);
- jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocation1DData(con, (RsAllocation)alloc, offset, lod, count, ptr, sizeBytes);
- _env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData1D_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint offset, jint lod, jint count, jshortArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation1DData_s, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, count, len, sizeBytes);
- jshort *ptr = _env->GetShortArrayElements(data, NULL);
- rsAllocation1DData(con, (RsAllocation)alloc, offset, lod, count, ptr, sizeBytes);
- _env->ReleaseShortArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData1D_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint offset, jint lod, jint count, jbyteArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation1DData_b, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, count, len, sizeBytes);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
- rsAllocation1DData(con, (RsAllocation)alloc, offset, lod, count, ptr, sizeBytes);
- _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData1D_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint offset, jint lod, jint count, jfloatArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation1DData_f, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, count, len, sizeBytes);
- jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocation1DData(con, (RsAllocation)alloc, offset, lod, count, ptr, sizeBytes);
- _env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
+ RsAllocation *alloc = (RsAllocation *)_alloc;
+ LOG_API("nAllocation1DData, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i), dataType(%i)",
+ con, alloc, offset, count, len, sizeBytes, dataType);
+ PER_ARRAY_TYPE(NULL, rsAllocation1DData, con, alloc, offset, lod, count, ptr, sizeBytes);
}
static void
@@ -656,47 +676,14 @@ nAllocationElementData1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc,
}
static void
-nAllocationData2D_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint lod, jint face,
- jint w, jint h, jshortArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation2DData_s, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
- jshort *ptr = _env->GetShortArrayElements(data, NULL);
- rsAllocation2DData(con, (RsAllocation)alloc, xoff, yoff, lod, (RsAllocationCubemapFace)face, w, h, ptr, sizeBytes, 0);
- _env->ReleaseShortArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData2D_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint lod, jint face,
- jint w, jint h, jbyteArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation2DData_b, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
- jbyte *ptr = _env->GetByteArrayElements(data, NULL);
- rsAllocation2DData(con, (RsAllocation)alloc, xoff, yoff, lod, (RsAllocationCubemapFace)face, w, h, ptr, sizeBytes, 0);
- _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData2D_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint lod, jint face,
- jint w, jint h, jintArray data, int sizeBytes)
+nAllocationData2D(JNIEnv *_env, jobject _this, RsContext con, jint _alloc, jint xoff, jint yoff, jint lod, jint _face,
+ jint w, jint h, jobject data, int sizeBytes, int dataType)
{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation2DData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
- jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocation2DData(con, (RsAllocation)alloc, xoff, yoff, lod, (RsAllocationCubemapFace)face, w, h, ptr, sizeBytes, 0);
- _env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
-}
-
-static void
-nAllocationData2D_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint lod, jint face,
- jint w, jint h, jfloatArray data, int sizeBytes)
-{
- jint len = _env->GetArrayLength(data);
- LOG_API("nAllocation2DData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
- jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocation2DData(con, (RsAllocation)alloc, xoff, yoff, lod, (RsAllocationCubemapFace)face, w, h, ptr, sizeBytes, 0);
- _env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
+ RsAllocation *alloc = (RsAllocation *)_alloc;
+ RsAllocationCubemapFace face = (RsAllocationCubemapFace)_face;
+ LOG_API("nAllocation2DData, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i) type(%i)",
+ con, alloc, xoff, yoff, w, h, sizeBytes, dataType);
+ PER_ARRAY_TYPE(NULL, rsAllocation2DData, con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
}
static void
@@ -724,47 +711,13 @@ 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)
+nAllocationData3D(JNIEnv *_env, jobject _this, RsContext con, jint _alloc, jint xoff, jint yoff, jint zoff, jint lod,
+ jint w, jint h, jint d, jobject data, int sizeBytes, int dataType)
{
- 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);
+ RsAllocation *alloc = (RsAllocation *)_alloc;
+ LOG_API("nAllocation3DData, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), lod(%i), w(%i), h(%i), d(%i), sizeBytes(%i)",
+ con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, sizeBytes);
+ PER_ARRAY_TYPE(NULL, rsAllocation3DData, con, alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0);
}
static void
@@ -1613,20 +1566,11 @@ static JNINativeMethod methods[] = {
{"rsnAllocationSetSurface", "(IILandroid/view/Surface;)V", (void*)nAllocationSetSurface },
{"rsnAllocationIoSend", "(II)V", (void*)nAllocationIoSend },
{"rsnAllocationIoReceive", "(II)V", (void*)nAllocationIoReceive },
-{"rsnAllocationData1D", "(IIIII[II)V", (void*)nAllocationData1D_i },
-{"rsnAllocationData1D", "(IIIII[SI)V", (void*)nAllocationData1D_s },
-{"rsnAllocationData1D", "(IIIII[BI)V", (void*)nAllocationData1D_b },
-{"rsnAllocationData1D", "(IIIII[FI)V", (void*)nAllocationData1D_f },
+{"rsnAllocationData1D", "(IIIIILjava/lang/Object;II)V", (void*)nAllocationData1D },
{"rsnAllocationElementData1D", "(IIIII[BI)V", (void*)nAllocationElementData1D },
-{"rsnAllocationData2D", "(IIIIIIII[II)V", (void*)nAllocationData2D_i },
-{"rsnAllocationData2D", "(IIIIIIII[SI)V", (void*)nAllocationData2D_s },
-{"rsnAllocationData2D", "(IIIIIIII[BI)V", (void*)nAllocationData2D_b },
-{"rsnAllocationData2D", "(IIIIIIII[FI)V", (void*)nAllocationData2D_f },
+{"rsnAllocationData2D", "(IIIIIIIILjava/lang/Object;II)V", (void*)nAllocationData2D },
{"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", "(IIIIIIIIILjava/lang/Object;II)V", (void*)nAllocationData3D },
{"rsnAllocationData3D", "(IIIIIIIIIIIIII)V", (void*)nAllocationData3D_alloc },
{"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i },
{"rsnAllocationRead", "(II[S)V", (void*)nAllocationRead_s },