Merge "Use Object + type in place of specific array"

This commit is contained in:
Tim Murray
2014-02-03 22:36:36 +00:00
committed by Gerrit Code Review
3 changed files with 97 additions and 195 deletions

View File

@ -801,7 +801,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked"); Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count; int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize); 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -817,7 +817,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked"); Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count; int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 2, dataSize); 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -833,7 +833,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked"); Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count; int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length, dataSize); 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -849,7 +849,7 @@ public class Allocation extends BaseObj {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked"); Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
int dataSize = mType.mElement.getBytesSize() * count; int dataSize = mType.mElement.getBytesSize() * count;
data1DChecks(off, count, d.length * 4, dataSize); 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -955,7 +955,7 @@ public class Allocation extends BaseObj {
mRS.validate(); mRS.validate();
validate2DRange(xoff, yoff, w, h); validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -964,7 +964,7 @@ public class Allocation extends BaseObj {
mRS.validate(); mRS.validate();
validate2DRange(xoff, yoff, w, h); validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -973,7 +973,7 @@ public class Allocation extends BaseObj {
mRS.validate(); mRS.validate();
validate2DRange(xoff, yoff, w, h); validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -982,7 +982,7 @@ public class Allocation extends BaseObj {
mRS.validate(); mRS.validate();
validate2DRange(xoff, yoff, w, h); validate2DRange(xoff, yoff, w, h);
mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, 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); Trace.traceEnd(RenderScript.TRACE_TAG);
} }
@ -1128,7 +1128,7 @@ public class Allocation extends BaseObj {
mRS.validate(); mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d); validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD, 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(); mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d); validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD, 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(); mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d); validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD, 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(); mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d); validate3DRange(xoff, yoff, zoff, w, h, d);
mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD, 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);
} }

View File

@ -386,25 +386,10 @@ public class RenderScript {
} }
native void rsnAllocationData1D(int con, 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, int[] d, int sizeBytes) { synchronized void nAllocationData1D(int id, int off, int mip, int count, Object d, int sizeBytes, Element.DataType dt) {
validate(); validate();
rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes); rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes, dt.mID);
}
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);
} }
native void rsnAllocationElementData1D(int con, int id, int xoff, int mip, int compIdx, byte[] d, int sizeBytes); 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); 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); native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face,
synchronized void nAllocationData2D(int id, int xoff, int yoff, int mip, int face, int w, int h, byte[] d, int sizeBytes) { 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(); 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, 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) {
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);
} }
native void rsnAllocationData2D(int con, int id, int xoff, int yoff, int mip, int face, Bitmap b); 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) { 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); 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); native void rsnAllocationData3D(int con, int id, int xoff, int yoff, int zoff, int mip,
synchronized void nAllocationData3D(int id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, byte[] d, int sizeBytes) { 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(); 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); native void rsnAllocationRead(int con, int id, byte[] d);
synchronized void nAllocationRead(int id, byte[] d) { synchronized void nAllocationRead(int id, byte[] d) {

View File

@ -50,6 +50,56 @@
using namespace android; 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 { class AutoJavaStringToUTF8 {
public: public:
AutoJavaStringToUTF8(JNIEnv* env, jstring str) : fEnv(env), fJStr(str) { AutoJavaStringToUTF8(JNIEnv* env, jstring str) : fEnv(env), fJStr(str) {
@ -605,43 +655,13 @@ static void ReleaseBitmapCallback(void *bmp)
static void 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); RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation1DData_i, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, count, len, sizeBytes); LOG_API("nAllocation1DData, con(%p), adapter(%p), offset(%i), count(%i), len(%i), sizeBytes(%i), dataType(%i)",
jint *ptr = _env->GetIntArrayElements(data, NULL); con, alloc, offset, count, len, sizeBytes, dataType);
rsAllocation1DData(con, (RsAllocation)alloc, offset, lod, count, ptr, sizeBytes); PER_ARRAY_TYPE(NULL, rsAllocation1DData, con, 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);
} }
static void static void
@ -656,47 +676,14 @@ nAllocationElementData1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc,
} }
static void static void
nAllocationData2D_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint lod, jint face, nAllocationData2D(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 w, jint h, jobject data, int sizeBytes, int dataType)
{ {
jint len = _env->GetArrayLength(data); RsAllocation *alloc = (RsAllocation *)_alloc;
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); RsAllocationCubemapFace face = (RsAllocationCubemapFace)_face;
jshort *ptr = _env->GetShortArrayElements(data, NULL); LOG_API("nAllocation2DData, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i) type(%i)",
rsAllocation2DData(con, (RsAllocation)alloc, xoff, yoff, lod, (RsAllocationCubemapFace)face, w, h, ptr, sizeBytes, 0); con, alloc, xoff, yoff, w, h, sizeBytes, dataType);
_env->ReleaseShortArrayElements(data, ptr, JNI_ABORT); PER_ARRAY_TYPE(NULL, rsAllocation2DData, con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
}
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)
{
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);
} }
static void static void
@ -724,47 +711,13 @@ nAllocationData2D_alloc(JNIEnv *_env, jobject _this, RsContext con,
} }
static void static void
nAllocationData3D_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jint xoff, jint yoff, jint zoff, jint lod, nAllocationData3D(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 w, jint h, jint d, jobject data, int sizeBytes, int dataType)
{ {
jint len = _env->GetArrayLength(data); RsAllocation *alloc = (RsAllocation *)_alloc;
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); LOG_API("nAllocation3DData, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), lod(%i), w(%i), h(%i), d(%i), sizeBytes(%i)",
jshort *ptr = _env->GetShortArrayElements(data, NULL); con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, sizeBytes);
rsAllocation3DData(con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0); PER_ARRAY_TYPE(NULL, rsAllocation3DData, con, 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 static void
@ -1613,20 +1566,11 @@ static JNINativeMethod methods[] = {
{"rsnAllocationSetSurface", "(IILandroid/view/Surface;)V", (void*)nAllocationSetSurface }, {"rsnAllocationSetSurface", "(IILandroid/view/Surface;)V", (void*)nAllocationSetSurface },
{"rsnAllocationIoSend", "(II)V", (void*)nAllocationIoSend }, {"rsnAllocationIoSend", "(II)V", (void*)nAllocationIoSend },
{"rsnAllocationIoReceive", "(II)V", (void*)nAllocationIoReceive }, {"rsnAllocationIoReceive", "(II)V", (void*)nAllocationIoReceive },
{"rsnAllocationData1D", "(IIIII[II)V", (void*)nAllocationData1D_i }, {"rsnAllocationData1D", "(IIIIILjava/lang/Object;II)V", (void*)nAllocationData1D },
{"rsnAllocationData1D", "(IIIII[SI)V", (void*)nAllocationData1D_s },
{"rsnAllocationData1D", "(IIIII[BI)V", (void*)nAllocationData1D_b },
{"rsnAllocationData1D", "(IIIII[FI)V", (void*)nAllocationData1D_f },
{"rsnAllocationElementData1D", "(IIIII[BI)V", (void*)nAllocationElementData1D }, {"rsnAllocationElementData1D", "(IIIII[BI)V", (void*)nAllocationElementData1D },
{"rsnAllocationData2D", "(IIIIIIII[II)V", (void*)nAllocationData2D_i }, {"rsnAllocationData2D", "(IIIIIIIILjava/lang/Object;II)V", (void*)nAllocationData2D },
{"rsnAllocationData2D", "(IIIIIIII[SI)V", (void*)nAllocationData2D_s },
{"rsnAllocationData2D", "(IIIIIIII[BI)V", (void*)nAllocationData2D_b },
{"rsnAllocationData2D", "(IIIIIIII[FI)V", (void*)nAllocationData2D_f },
{"rsnAllocationData2D", "(IIIIIIIIIIIII)V", (void*)nAllocationData2D_alloc }, {"rsnAllocationData2D", "(IIIIIIIIIIIII)V", (void*)nAllocationData2D_alloc },
{"rsnAllocationData3D", "(IIIIIIIII[II)V", (void*)nAllocationData3D_i }, {"rsnAllocationData3D", "(IIIIIIIIILjava/lang/Object;II)V", (void*)nAllocationData3D },
{"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 }, {"rsnAllocationData3D", "(IIIIIIIIIIIIII)V", (void*)nAllocationData3D_alloc },
{"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i }, {"rsnAllocationRead", "(II[I)V", (void*)nAllocationRead_i },
{"rsnAllocationRead", "(II[S)V", (void*)nAllocationRead_s }, {"rsnAllocationRead", "(II[S)V", (void*)nAllocationRead_s },