Adds invocable functions to ScriptGroup

This also includes InvokeID support

Change-Id: I5b59df166ea30b309b8dd9623825ac0e72d03856
This commit is contained in:
Yang Ni
2015-01-23 17:16:02 -08:00
parent 240e874397
commit be392ad35e
5 changed files with 439 additions and 3 deletions

View File

@ -65,6 +65,46 @@ public class Script extends BaseObj {
return k;
}
/**
* @hide Pending API review
* InvokeID is an identifier for an invoke function. It is used
* as an identifier for ScriptGroup creation.
*
* This class should not be directly created. Instead use the method in the
* reflected or intrinsic code "getInvokeID_funcname()".
*
*/
public static final class InvokeID extends BaseObj {
Script mScript;
int mSlot;
InvokeID(long id, RenderScript rs, Script s, int slot) {
super(id, rs);
mScript = s;
mSlot = slot;
}
}
private final SparseArray<InvokeID> mIIDs = new SparseArray<InvokeID>();
/**
* @hide Pending API review
* Only to be used by generated reflected classes.
*/
protected InvokeID createInvokeID(int slot) {
InvokeID i = mIIDs.get(slot);
if (i != null) {
return i;
}
long id = mRS.nScriptInvokeIDCreate(getID(mRS), slot);
if (id == 0) {
throw new RSDriverException("Failed to create KernelID");
}
i = new InvokeID(id, mRS, this, slot);
mIIDs.put(slot, i);
return i;
}
/**
* FieldID is an identifier for a Script + exported field pair. It is used
* as an identifier for ScriptGroup creation.