am 8704ae46
: Merge "Add name to ScriptGroup2.Builder.create() method"
* commit '8704ae464a001e17275257d19eae688ff3a28892': Add name to ScriptGroup2.Builder.create() method
This commit is contained in:
@ -332,10 +332,12 @@ public class RenderScript {
|
|||||||
rsnClosureSetGlobal(mContext, closureID, fieldID, value, size);
|
rsnClosureSetGlobal(mContext, closureID, fieldID, value, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
native long rsnScriptGroup2Create(long con, String cachePath, long[] closures);
|
native long rsnScriptGroup2Create(long con, String name, String cachePath,
|
||||||
synchronized long nScriptGroup2Create(String cachePath, long[] closures) {
|
long[] closures);
|
||||||
|
synchronized long nScriptGroup2Create(String name, String cachePath,
|
||||||
|
long[] closures) {
|
||||||
validate();
|
validate();
|
||||||
return rsnScriptGroup2Create(mContext, cachePath, closures);
|
return rsnScriptGroup2Create(mContext, name, cachePath, closures);
|
||||||
}
|
}
|
||||||
|
|
||||||
native void rsnScriptGroup2Execute(long con, long groupID);
|
native void rsnScriptGroup2Execute(long con, long groupID);
|
||||||
|
@ -289,6 +289,7 @@ public class ScriptGroup2 extends BaseObj {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mName;
|
||||||
List<Closure> mClosures;
|
List<Closure> mClosures;
|
||||||
List<UnboundValue> mInputs;
|
List<UnboundValue> mInputs;
|
||||||
Future[] mOutputs;
|
Future[] mOutputs;
|
||||||
@ -299,9 +300,10 @@ public class ScriptGroup2 extends BaseObj {
|
|||||||
super(id, rs);
|
super(id, rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptGroup2(RenderScript rs, List<Closure> closures,
|
ScriptGroup2(RenderScript rs, String name, List<Closure> closures,
|
||||||
List<UnboundValue> inputs, Future[] outputs) {
|
List<UnboundValue> inputs, Future[] outputs) {
|
||||||
super(0, rs);
|
super(0, rs);
|
||||||
|
mName = name;
|
||||||
mClosures = closures;
|
mClosures = closures;
|
||||||
mInputs = inputs;
|
mInputs = inputs;
|
||||||
mOutputs = outputs;
|
mOutputs = outputs;
|
||||||
@ -310,7 +312,7 @@ public class ScriptGroup2 extends BaseObj {
|
|||||||
for (int i = 0; i < closureIDs.length; i++) {
|
for (int i = 0; i < closureIDs.length; i++) {
|
||||||
closureIDs[i] = closures.get(i).getID(rs);
|
closureIDs[i] = closures.get(i).getID(rs);
|
||||||
}
|
}
|
||||||
long id = rs.nScriptGroup2Create(ScriptC.mCachePath, closureIDs);
|
long id = rs.nScriptGroup2Create(name, ScriptC.mCachePath, closureIDs);
|
||||||
setID(id);
|
setID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +419,7 @@ public class ScriptGroup2 extends BaseObj {
|
|||||||
!name.equals(name.replaceAll("[^a-zA-Z0-9-]", "_"))) {
|
!name.equals(name.replaceAll("[^a-zA-Z0-9-]", "_"))) {
|
||||||
throw new RSIllegalArgumentException("invalid script group name");
|
throw new RSIllegalArgumentException("invalid script group name");
|
||||||
}
|
}
|
||||||
ScriptGroup2 ret = new ScriptGroup2(mRS, mClosures, mInputs, outputs);
|
ScriptGroup2 ret = new ScriptGroup2(mRS, name, mClosures, mInputs, outputs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,8 +423,9 @@ nClosureSetGlobal(JNIEnv *_env, jobject _this, jlong con, jlong closureID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
nScriptGroup2Create(JNIEnv *_env, jobject _this, jlong con,
|
nScriptGroup2Create(JNIEnv *_env, jobject _this, jlong con, jstring name,
|
||||||
jstring cacheDir, jlongArray closureArray) {
|
jstring cacheDir, jlongArray closureArray) {
|
||||||
|
AutoJavaStringToUTF8 nameUTF(_env, name);
|
||||||
AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
|
AutoJavaStringToUTF8 cacheDirUTF(_env, cacheDir);
|
||||||
|
|
||||||
jlong* jClosures = _env->GetLongArrayElements(closureArray, nullptr);
|
jlong* jClosures = _env->GetLongArrayElements(closureArray, nullptr);
|
||||||
@ -435,7 +436,8 @@ nScriptGroup2Create(JNIEnv *_env, jobject _this, jlong con,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (jlong)(uintptr_t)rsScriptGroup2Create(
|
return (jlong)(uintptr_t)rsScriptGroup2Create(
|
||||||
(RsContext)con, cacheDirUTF.c_str(), cacheDirUTF.length(),
|
(RsContext)con, nameUTF.c_str(), nameUTF.length(),
|
||||||
|
cacheDirUTF.c_str(), cacheDirUTF.length(),
|
||||||
closures, numClosures);
|
closures, numClosures);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2414,7 +2416,7 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnScriptInvokeIDCreate", "(JJI)J", (void*)nScriptInvokeIDCreate },
|
{"rsnScriptInvokeIDCreate", "(JJI)J", (void*)nScriptInvokeIDCreate },
|
||||||
{"rsnScriptFieldIDCreate", "(JJI)J", (void*)nScriptFieldIDCreate },
|
{"rsnScriptFieldIDCreate", "(JJI)J", (void*)nScriptFieldIDCreate },
|
||||||
{"rsnScriptGroupCreate", "(J[J[J[J[J[J)J", (void*)nScriptGroupCreate },
|
{"rsnScriptGroupCreate", "(J[J[J[J[J[J)J", (void*)nScriptGroupCreate },
|
||||||
{"rsnScriptGroup2Create", "(JLjava/lang/String;[J)J", (void*)nScriptGroup2Create },
|
{"rsnScriptGroup2Create", "(JLjava/lang/String;Ljava/lang/String;[J)J", (void*)nScriptGroup2Create },
|
||||||
{"rsnScriptGroupSetInput", "(JJJJ)V", (void*)nScriptGroupSetInput },
|
{"rsnScriptGroupSetInput", "(JJJJ)V", (void*)nScriptGroupSetInput },
|
||||||
{"rsnScriptGroupSetOutput", "(JJJJ)V", (void*)nScriptGroupSetOutput },
|
{"rsnScriptGroupSetOutput", "(JJJJ)V", (void*)nScriptGroupSetOutput },
|
||||||
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
||||||
|
Reference in New Issue
Block a user