Remove more pieces of setRoot. Add pointer to allocation lookup for scripts.
Change-Id: I2c3075d2056f02bb834bfad403dc72da991f3156
This commit is contained in:
@@ -138,7 +138,6 @@ public class RenderScript {
|
||||
native void nScriptSetClearDepth(int script, float depth);
|
||||
native void nScriptSetClearStencil(int script, int stencil);
|
||||
native void nScriptSetTimeZone(int script, byte[] timeZone);
|
||||
native void nScriptSetRoot(boolean isRoot);
|
||||
native void nScriptInvoke(int id, int slot);
|
||||
native void nScriptInvokeData(int id, int slot);
|
||||
native void nScriptInvokeV(int id, int slot, byte[] params);
|
||||
|
||||
@@ -39,11 +39,11 @@ public class ScriptC extends Script {
|
||||
|
||||
protected ScriptC(RenderScript rs, Resources resources, int resourceID, boolean isRoot) {
|
||||
super(0, rs);
|
||||
mID = internalCreate(rs, resources, resourceID, isRoot);
|
||||
mID = internalCreate(rs, resources, resourceID);
|
||||
}
|
||||
|
||||
|
||||
private static synchronized int internalCreate(RenderScript rs, Resources resources, int resourceID, boolean isRoot) {
|
||||
private static synchronized int internalCreate(RenderScript rs, Resources resources, int resourceID) {
|
||||
byte[] pgm;
|
||||
int pgmLength;
|
||||
InputStream is = resources.openRawResource(resourceID);
|
||||
@@ -74,7 +74,6 @@ public class ScriptC extends Script {
|
||||
|
||||
rs.nScriptCBegin();
|
||||
rs.nScriptCSetScript(pgm, 0, pgmLength);
|
||||
rs.nScriptSetRoot(isRoot);
|
||||
return rs.nScriptCCreate();
|
||||
}
|
||||
|
||||
|
||||
@@ -949,13 +949,6 @@ nScriptInvokeV(JNIEnv *_env, jobject _this, jint script, jint slot, jbyteArray d
|
||||
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
|
||||
}
|
||||
|
||||
static void
|
||||
nScriptSetRoot(JNIEnv *_env, jobject _this, jboolean isRoot)
|
||||
{
|
||||
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
|
||||
LOG_API("nScriptCSetRoot, con(%p), isRoot(%i)", con, isRoot);
|
||||
rsScriptSetRoot(con, isRoot);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
@@ -1421,7 +1414,6 @@ static JNINativeMethod methods[] = {
|
||||
{"nScriptSetClearDepth", "(IF)V", (void*)nScriptSetClearDepth },
|
||||
{"nScriptSetClearStencil", "(II)V", (void*)nScriptSetClearStencil },
|
||||
{"nScriptSetTimeZone", "(I[B)V", (void*)nScriptSetTimeZone },
|
||||
{"nScriptSetRoot", "(Z)V", (void*)nScriptSetRoot },
|
||||
{"nScriptInvoke", "(II)V", (void*)nScriptInvoke },
|
||||
{"nScriptInvokeData", "(II)V", (void*)nScriptInvokeData },
|
||||
{"nScriptInvokeV", "(II[B)V", (void*)nScriptInvokeV },
|
||||
|
||||
@@ -217,7 +217,6 @@ public class FilmRS {
|
||||
|
||||
ScriptC.Builder sb = new ScriptC.Builder(mRS);
|
||||
sb.setScript(mRes, R.raw.filmstrip);
|
||||
//sb.setRoot(true);
|
||||
//sb.setType(mStripPositionType, "Pos", 1);
|
||||
mScriptStrip = sb.create();
|
||||
mScriptStrip.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
@@ -293,10 +293,6 @@ ScriptInvokeV {
|
||||
togglePlay
|
||||
}
|
||||
|
||||
ScriptSetRoot {
|
||||
param bool isRoot
|
||||
}
|
||||
|
||||
ScriptSetVarI {
|
||||
param RsScript s
|
||||
param uint32_t slot
|
||||
|
||||
@@ -97,12 +97,6 @@ void rsi_ScriptSetType(Context * rsc, RsType vt, uint32_t slot, bool writable, c
|
||||
LOGE("rsi_ScriptSetType");
|
||||
}
|
||||
|
||||
void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot)
|
||||
{
|
||||
LOGE("rsi_ScriptSetInvoke");
|
||||
}
|
||||
|
||||
|
||||
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot)
|
||||
{
|
||||
//LOGE("rsi_ScriptInvoke %i", slot);
|
||||
@@ -177,11 +171,6 @@ void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *dat
|
||||
|
||||
}
|
||||
|
||||
void rsi_ScriptSetRoot(Context * rsc, bool isRoot)
|
||||
{
|
||||
LOGE("rsi_ScriptSetRoot");
|
||||
}
|
||||
|
||||
void rsi_ScriptSetVarI(Context *rsc, RsScript vs, uint32_t slot, int value)
|
||||
{
|
||||
Script *s = static_cast<Script *>(vs);
|
||||
|
||||
@@ -71,6 +71,22 @@ void ScriptC::setupScript()
|
||||
}
|
||||
}
|
||||
|
||||
const Allocation *ScriptC::ptrToAllocation(const void *ptr) const
|
||||
{
|
||||
if (!ptr) {
|
||||
return NULL;
|
||||
}
|
||||
for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) {
|
||||
if (!mSlots[ct].get())
|
||||
continue;
|
||||
if (mSlots[ct]->getPtr() == ptr) {
|
||||
return mSlots[ct].get();
|
||||
}
|
||||
}
|
||||
LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
uint32_t ScriptC::run(Context *rsc, uint32_t launchIndex)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
|
||||
BCCscript* mBccScript;
|
||||
|
||||
const Allocation *ptrToAllocation(const void *) const;
|
||||
|
||||
virtual void setupScript();
|
||||
virtual uint32_t run(Context *, uint32_t launchID);
|
||||
};
|
||||
|
||||
@@ -1113,6 +1113,14 @@ int SC_divsi3(int a, int b)
|
||||
return a / b;
|
||||
}
|
||||
|
||||
int SC_getAllocation(const void *ptr)
|
||||
{
|
||||
GET_TLS();
|
||||
const Allocation *alloc = sc->ptrToAllocation(ptr);
|
||||
return (int)alloc;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Class implementation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1368,6 +1376,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
|
||||
{ "debugPi", (void *)&SC_debugPi },
|
||||
|
||||
{ "scriptCall", (void *)&SC_scriptCall },
|
||||
{ "rsGetAllocation", (void *)&SC_getAllocation },
|
||||
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -650,4 +650,5 @@ extern void matrixRotate(void *mat, float rot, float x, float y, float z);
|
||||
extern void matrixScale(void *mat, float x, float y, float z);
|
||||
extern void matrixTranslate(void *mat, float x, float y, float z);
|
||||
|
||||
extern rs_allocation rsGetAllocation(const void *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user