summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2016-06-13 22:27:37 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-13 22:27:37 +0000
commit42d18d85cb58b238c77a9460f37ba666f7c8b106 (patch)
tree1a14342cc7cb0b46a1a725d990a41d7bb05b5585 /support
parent1af9cd2a9c34ebb2cde5be732662c7e75aa3e678 (diff)
parentd602b3121f8eed302002aed88ea6d881fc73dd24 (diff)
downloadrs-42d18d85cb58b238c77a9460f37ba666f7c8b106.tar.gz
Merge \\\"Delete simple reduction implementation.\\\" into nyc-dev am: ad849948dc am: 1480d8fef2
am: bf4a699f72 Change-Id: Icbe8ba724664265e1ae02bd0d0721634beabf74e
Diffstat (limited to 'support')
-rw-r--r--support/java/src/android/support/v8/renderscript/RenderScript.java24
-rw-r--r--support/java/src/android/support/v8/renderscript/Script.java31
-rw-r--r--support/jni/android_renderscript_RenderScript.cpp70
3 files changed, 12 insertions, 113 deletions
diff --git a/support/java/src/android/support/v8/renderscript/RenderScript.java b/support/java/src/android/support/v8/renderscript/RenderScript.java
index afd09243..a5c6f934 100644
--- a/support/java/src/android/support/v8/renderscript/RenderScript.java
+++ b/support/java/src/android/support/v8/renderscript/RenderScript.java
@@ -55,8 +55,6 @@ public class RenderScript {
static private ArrayList<RenderScript> mProcessContextList = new ArrayList<RenderScript>();
private boolean mIsProcessContext = false;
private boolean mEnableMultiInput = false;
- // TODO: Update to set to true at the correct API level when reduce is added.
- private boolean mEnableReduce = false;
private int mDispatchAPILevel = 0;
private int mContextFlags = 0;
@@ -675,24 +673,12 @@ public class RenderScript {
rsnScriptForEach(mContext, id, slot, ains, aout, params, limits);
}
- native void rsnScriptReduce(long con, long id, int slot, long ain, long aout,
- int[] limits);
- synchronized void nScriptReduce(long id, int slot, long ain, long aout, int[] limits) {
- if (!mEnableReduce) {
- // TODO: Update to include the API level when reduce is added.
- Log.e(LOG_TAG, "Reduce kernels are not supported");
- throw new RSRuntimeException("Reduce kernels are not supported");
- }
- validate();
- rsnScriptReduce(mContext, id, slot, ain, aout, limits);
- }
-
- native void rsnScriptReduceNew(long con, long id, int slot, long[] ains,
- long aout, int[] limits);
- synchronized void nScriptReduceNew(long id, int slot, long ains[], long aout,
- int[] limits) {
+ native void rsnScriptReduce(long con, long id, int slot, long[] ains,
+ long aout, int[] limits);
+ synchronized void nScriptReduce(long id, int slot, long ains[], long aout,
+ int[] limits) {
validate();
- rsnScriptReduceNew(mContext, id, slot, ains, aout, limits);
+ rsnScriptReduce(mContext, id, slot, ains, aout, limits);
}
native void rsnScriptInvokeV(long con, long id, int slot, byte[] params, boolean mUseInc);
diff --git a/support/java/src/android/support/v8/renderscript/Script.java b/support/java/src/android/support/v8/renderscript/Script.java
index 3b2f90a5..ec3a7a9a 100644
--- a/support/java/src/android/support/v8/renderscript/Script.java
+++ b/support/java/src/android/support/v8/renderscript/Script.java
@@ -383,35 +383,6 @@ public class Script extends BaseObj {
}
/**
- * Only intended for use by generated reflected code. (Simple reduction)
- *
- * @hide
- */
- protected void reduce(int slot, Allocation ain, Allocation aout, LaunchOptions sc) {
- mRS.validate();
- mRS.validateObject(ain);
- mRS.validateObject(aout);
-
- if (ain == null || aout == null) {
- throw new RSIllegalArgumentException(
- "Both ain and aout are required to be non-null.");
- }
-
- long in_id = ain.getID(mRS);
- long out_id = aout.getID(mRS);
-
- int[] limits = null;
- if (sc != null) {
- limits = new int[2];
-
- limits[0] = sc.xstart;
- limits[1] = sc.xend;
- }
-
- mRS.nScriptReduce(getID(mRS), slot, in_id, out_id, limits);
- }
-
- /**
* Only intended for use by generated reflected code. (General reduction)
*
* @hide
@@ -448,7 +419,7 @@ public class Script extends BaseObj {
limits[5] = sc.zend;
}
- mRS.nScriptReduceNew(getID(mRS), slot, in_ids, out_id, limits);
+ mRS.nScriptReduce(getID(mRS), slot, in_ids, out_id, limits);
}
/**
diff --git a/support/jni/android_renderscript_RenderScript.cpp b/support/jni/android_renderscript_RenderScript.cpp
index 78de8d5b..56428355 100644
--- a/support/jni/android_renderscript_RenderScript.cpp
+++ b/support/jni/android_renderscript_RenderScript.cpp
@@ -1749,66 +1749,9 @@ exit:
static void
nScriptReduce(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
- jlong ain, jlong aout, jintArray limits)
+ jlongArray ains, jlong aout, jintArray limits)
{
- LOG_API("nScriptReduce, con(%p), s(%p), slot(%i) ain(%" PRId64 ") aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ain, aout);
-
- RsScriptCall sc, *sca = nullptr;
- uint32_t sc_size = 0;
-
- jint limit_len = 0;
- jint *limit_ptr = nullptr;
-
- bool limitLengthValid = true;
-
- // If the caller passed limits, reflect them in the RsScriptCall.
- if (limits != nullptr) {
- limit_len = _env->GetArrayLength(limits);
- limit_ptr = _env->GetIntArrayElements(limits, nullptr);
-
- // We expect to be passed an array [x1, x2] which specifies
- // the sub-range for a 1-dimensional reduction.
- if (limit_len == 2) {
- sc.xStart = limit_ptr[0];
- sc.xEnd = limit_ptr[1];
- sc.yStart = 0;
- sc.yEnd = 0;
- sc.zStart = 0;
- sc.zEnd = 0;
- sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- sc.arrayStart = 0;
- sc.arrayEnd = 0;
- sc.array2Start = 0;
- sc.array2End = 0;
- sc.array3Start = 0;
- sc.array3End = 0;
- sc.array4Start = 0;
- sc.array4End = 0;
-
- sca = &sc;
- sc_size = sizeof(sc);
- } else {
- LOG_ERR("LaunchOptions cannot be recognized.");
- limitLengthValid = false;
- }
- }
-
- if (limitLengthValid) {
- dispatchTab.ScriptReduce((RsContext)con, (RsScript)script, slot,
- (RsAllocation)ain, (RsAllocation)aout,
- sca, sc_size);
- }
-
- if (limits != nullptr) {
- _env->ReleaseIntArrayElements(limits, limit_ptr, JNI_ABORT);
- }
-}
-
-static void
-nScriptReduceNew(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot,
- jlongArray ains, jlong aout, jintArray limits)
-{
- LOG_API("nScriptReduceNew, con(%p), s(%p), slot(%i) ains(%p) aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ains, aout);
+ LOG_API("nScriptReduce, con(%p), s(%p), slot(%i) ains(%p) aout(%" PRId64 ")", (RsContext)con, (void *)script, slot, ains, aout);
if (ains == nullptr) {
LOG_ERR("At least one input required.");
@@ -1891,9 +1834,9 @@ nScriptReduceNew(JNIEnv *_env, jobject _this, jlong con, jlong script, jint slot
sc_size = sizeof(sc);
}
- dispatchTab.ScriptReduceNew((RsContext)con, (RsScript)script, slot,
- in_allocs, in_len, (RsAllocation)aout,
- sca, sc_size);
+ dispatchTab.ScriptReduce((RsContext)con, (RsScript)script, slot,
+ in_allocs, in_len, (RsAllocation)aout,
+ sca, sc_size);
_env->ReleaseLongArrayElements(ains, in_ptr, JNI_ABORT);
@@ -2404,8 +2347,7 @@ static JNINativeMethod methods[] = {
{"rsnScriptForEach", "(JJI[JJ[B[I)V", (void*)nScriptForEachMulti },
{"rsnScriptForEachClipped", "(JJJIJJIIIIIIZ)V", (void*)nScriptForEachClipped },
{"rsnScriptForEachClipped", "(JJJIJJ[BIIIIIIZ)V", (void*)nScriptForEachClippedV },
-{"rsnScriptReduce", "(JJIJJ[I)V", (void*)nScriptReduce },
-{"rsnScriptReduceNew", "(JJI[JJ[I)V", (void*)nScriptReduceNew },
+{"rsnScriptReduce", "(JJI[JJ[I)V", (void*)nScriptReduce },
{"rsnScriptSetVarI", "(JJIIZ)V", (void*)nScriptSetVarI },
{"rsnScriptSetVarJ", "(JJIJZ)V", (void*)nScriptSetVarJ },
{"rsnScriptSetVarF", "(JJIFZ)V", (void*)nScriptSetVarF },